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

3.9.0.1 #3986

Merged
merged 19 commits into from
Jun 3, 2021
Merged

3.9.0.1 #3986

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0003e01
Fixes #3478 Enable installation through composer v2 (PR #3928)
Tabrisrp May 21, 2021
f8fe314
Re-add change to remove disable preload fonts when CPCSS is enabled (…
Tabrisrp May 21, 2021
fd29255
Stop preload while prewarmup is running (PR #3925)
engahmeds3ed May 25, 2021
b30ddba
remove charset=UTF-8 (PR #3946)
mostafa-hisham May 25, 2021
b4ba77f
Add unit tests code coverage (PR #3922)
Tabrisrp May 26, 2021
f4e01d6
Fix failing tests related to adding prewarmup functionality (PR #3949)
engahmeds3ed May 27, 2021
415f779
change trigger event to push
Tabrisrp May 28, 2021
0e62e05
Fixes RUCSS tests: update time to prevent tests failures (PR #3973)
Tabrisrp May 31, 2021
e711532
Fixes #3600 add wpstage to staging servers list (PR #3948)
mostafa-hisham Jun 1, 2021
56c1b50
remove image optimization when WP_ROCKET_WHITE_LABEL_ACCOUNT (PR #3956)
mostafa-hisham Jun 1, 2021
996a8c4
Add Hubspot iframe inline JS exclusion from combine JS (PR #3943)
NataliaDrause Jun 1, 2021
79f00a2
Fixes #3945 Display warning when WP Meteor is enabled with WP Rocket …
Tabrisrp Jun 1, 2021
834905d
Fixes #3924 Remove unnecessary more info link in RUCSS pre-warmup cop…
Tabrisrp Jun 1, 2021
81c1a19
Compatibility with Impreza theme (PR #3972)
GeekPress Jun 2, 2021
50decd4
Update delay JS script (PR #3971)
Tabrisrp Jun 2, 2021
f0ff790
Fixes #2876 Remove beacon button when white label is enabled (PR #3965)
mostafa-hisham Jun 2, 2021
1a4c05c
Add additional delay JS exclusions (PR #3975)
Tabrisrp Jun 2, 2021
18b08b4
update plugin version to 3.9.0.1
Tabrisrp Jun 2, 2021
59045e5
update operator in version_compare
Tabrisrp Jun 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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