Skip to content

Commit 1eeda4d

Browse files
authored
Remove WP Super Cache from the Jetpack monorepo (#852)
1 parent a67014c commit 1eeda4d

81 files changed

Lines changed: 3961 additions & 1462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Our standard eslint config reads .gitignore and .eslintignore to determine what to ignore.
2+
3+
# @todo: Files below ignored as part of Automattic/jetpack/pull/25449
4+
# They can be removed here as lint errors are addressed.
5+
/inc/delete-cache-button.js
6+
/inc/preload-notification.js

.gitattributes

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
1-
# Automatically generated rules.
2-
/.git* export-ignore
3-
4-
# Package attributes file.
5-
# Files not needed to be distributed in the package.
6-
.gitattributes export-ignore
7-
.github/ export-ignore
8-
package.json export-ignore
9-
10-
# Files to include in the mirror repo, but excluded via gitignore
11-
# Remember to end all directories with `/**` to properly tag every file.
12-
# /src/js/example.min.js production-include
13-
14-
/jetpack_vendor/** production-include
15-
/vendor/autoload.php production-include
16-
/vendor/composer/** production-include
17-
/vendor/automattic/jetpack-device-detection/** production-include
18-
19-
# Files to exclude from the mirror repo, but included in the monorepo.
20-
# Remember to end all directories with `/**` to properly tag every file.
21-
.gitignore production-exclude
22-
.phpcs.dir.xml production-exclude
23-
changelog/** production-exclude
24-
tests/** production-exclude
1+
# Files not needed in the release zip.
2+
/.git* export-ignore
3+
.gitattributes export-ignore
4+
.github/ export-ignore
5+
package.json export-ignore
6+
tests/ export-ignore
7+
.phan/ export-ignore
8+
phpunit.*.xml.dist export-ignore
9+
.phpcs.* export-ignore
10+
.eslintignore export-ignore
11+
eslint.config.mjs export-ignore
12+
changelog/ export-ignore
13+
.w.org-assets/ export-ignore

.github/workflows/changelogger.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Changelogger
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
validate:
8+
name: Validate changelog
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.4'
17+
tools: composer
18+
coverage: none
19+
- run: composer install --no-progress
20+
- name: Check for changelog entry
21+
run: |
22+
BASE_SHA=${{ github.event.pull_request.base.sha }}
23+
HEAD_SHA=${{ github.event.pull_request.head.sha }}
24+
CHANGELOG_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" -- 'changelog/*')
25+
if [ -z "$CHANGELOG_FILES" ]; then
26+
echo "::warning::No changelog entry found. If this change is user-facing, please add one with: vendor/bin/changelogger add"
27+
fi

.github/workflows/e2e-tests.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/linting.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Linting
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [trunk]
7+
8+
jobs:
9+
phpcs:
10+
name: PHPCS
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.4'
17+
tools: composer
18+
coverage: none
19+
- run: composer install --no-progress
20+
- run: vendor/bin/phpcs

.github/workflows/php-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: PHP Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [trunk]
7+
8+
jobs:
9+
phpunit:
10+
name: PHPUnit (PHP ${{ matrix.php }})
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: ['8.2', '8.3', '8.4', '8.5']
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: ${{ matrix.php }}
21+
tools: composer
22+
coverage: none
23+
- run: composer install --no-progress
24+
- run: composer test-php

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
node_modules/

.phan/baseline.php

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* This is an automatically generated baseline for Phan issues.
4+
* When Phan is invoked with --load-baseline=path/to/baseline.php,
5+
* The pre-existing issues listed in this file won't be emitted.
6+
*
7+
* This file can be updated by invoking Phan with --save-baseline=path/to/baseline.php
8+
* (can be combined with --load-baseline)
9+
*/
10+
return [
11+
// # Issue statistics:
12+
// PhanPluginSimplifyExpressionBool : 80+ occurrences
13+
// PhanUndeclaredGlobalVariable : 45+ occurrences
14+
// PhanPossiblyUndeclaredVariable : 20+ occurrences
15+
// PhanUndeclaredVariable : 20+ occurrences
16+
// PhanTypeMismatchArgument : 10+ occurrences
17+
// PhanTypeMismatchArgumentNullableInternal : 10+ occurrences
18+
// PhanTypeMismatchReturn : 10+ occurrences
19+
// PhanTypeNonVarPassByRef : 10+ occurrences
20+
// PhanTypePossiblyInvalidDimOffset : 10+ occurrences
21+
// PhanUndeclaredFunctionInCallable : 10+ occurrences
22+
// PhanTypeMismatchArgumentProbablyReal : 9 occurrences
23+
// PhanUndeclaredFunction : 8 occurrences
24+
// PhanSuspiciousValueComparison : 6 occurrences
25+
// PhanTypeArraySuspiciousNull : 6 occurrences
26+
// PhanTypeInvalidDimOffset : 6 occurrences
27+
// PhanUndeclaredVariableDim : 6 occurrences
28+
// PhanTypeArraySuspiciousNullable : 5 occurrences
29+
// PhanTypeMismatchArgumentInternalProbablyReal : 4 occurrences
30+
// PhanTypeMismatchArgumentInternalReal : 4 occurrences
31+
// PhanPluginDuplicateConditionalNullCoalescing : 3 occurrences
32+
// PhanTypeInvalidLeftOperandOfNumericOp : 3 occurrences
33+
// PhanTypeSuspiciousNonTraversableForeach : 3 occurrences
34+
// PhanUndeclaredClassMethod : 3 occurrences
35+
// PhanPluginDuplicateAdjacentStatement : 2 occurrences
36+
// PhanPluginDuplicateExpressionAssignmentOperation : 2 occurrences
37+
// PhanPluginNeverReturnFunction : 2 occurrences
38+
// PhanPluginUnreachableCode : 2 occurrences
39+
// PhanPossiblyUndeclaredGlobalVariable : 2 occurrences
40+
// PhanTypeMismatchArgumentNullable : 2 occurrences
41+
// PhanTypeSuspiciousStringExpression : 2 occurrences
42+
// PhanCommentParamWithoutRealParam : 1 occurrence
43+
// PhanTypeConversionFromArray : 1 occurrence
44+
// PhanTypeInvalidLeftOperandOfBitwiseOp : 1 occurrence
45+
// PhanTypeInvalidRightOperandOfAdd : 1 occurrence
46+
// PhanTypeInvalidRightOperandOfBitwiseOp : 1 occurrence
47+
// PhanTypeMismatchArgumentInternal : 1 occurrence
48+
// PhanTypeMismatchDimAssignment : 1 occurrence
49+
// PhanTypeMismatchProperty : 1 occurrence
50+
// PhanTypeMissingReturn : 1 occurrence
51+
// PhanUndeclaredConstant : 1 occurrence
52+
53+
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
54+
'file_suppressions' => [
55+
'advanced-cache.php' => ['PhanPluginSimplifyExpressionBool'],
56+
'inc/delete-cache-button.php' => ['PhanPluginNeverReturnFunction', 'PhanTypeMismatchArgument'],
57+
'ossdl-cdn.php' => ['PhanUndeclaredClassMethod'],
58+
'partials/advanced.php' => ['PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeNonVarPassByRef', 'PhanUndeclaredGlobalVariable'],
59+
'partials/debug.php' => ['PhanTypeNonVarPassByRef', 'PhanUndeclaredGlobalVariable'],
60+
'partials/easy.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredConstant', 'PhanUndeclaredGlobalVariable'],
61+
'partials/lockdown.php' => ['PhanUndeclaredGlobalVariable'],
62+
'partials/preload.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimAssignment', 'PhanUndeclaredGlobalVariable'],
63+
'partials/tracking_parameters.php' => ['PhanUndeclaredGlobalVariable'],
64+
'plugins/domain-mapping.php' => ['PhanUndeclaredFunction'],
65+
'plugins/jetpack.php' => ['PhanPluginSimplifyExpressionBool'],
66+
'plugins/wptouch.php' => ['PhanPluginSimplifyExpressionBool', 'PhanUndeclaredFunction'],
67+
'rest/class.wp-super-cache-rest-get-cache.php' => ['PhanPluginSimplifyExpressionBool'],
68+
'rest/class.wp-super-cache-rest-get-settings.php' => ['PhanPluginSimplifyExpressionBool', 'PhanSuspiciousValueComparison', 'PhanTypeMismatchReturn', 'PhanUndeclaredFunctionInCallable', 'PhanUndeclaredVariable'],
69+
'rest/class.wp-super-cache-rest-get-status.php' => ['PhanPluginSimplifyExpressionBool', 'PhanSuspiciousValueComparison', 'PhanTypeNonVarPassByRef', 'PhanUndeclaredVariable'],
70+
'rest/class.wp-super-cache-rest-test-cache.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeConversionFromArray', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredVariableDim'],
71+
'rest/class.wp-super-cache-rest-update-settings.php' => ['PhanCommentParamWithoutRealParam', 'PhanPluginSimplifyExpressionBool', 'PhanTypeMissingReturn'],
72+
'src/device-detection/class-user-agent-info.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchProperty', 'PhanTypeMismatchReturn'],
73+
'tests/e2e/tools/mu-test-helpers.php' => ['PhanTypeMismatchArgument'],
74+
'wp-cache-base.php' => ['PhanTypeMismatchArgumentNullableInternal'],
75+
'wp-cache-phase1.php' => ['PhanTypeNonVarPassByRef'],
76+
'wp-cache-phase2.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPluginUnreachableCode', 'PhanPossiblyUndeclaredVariable', 'PhanSuspiciousValueComparison', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternalProbablyReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeNonVarPassByRef', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredVariableDim'],
77+
'wp-cache.php' => ['PhanPluginDuplicateAdjacentStatement', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginNeverReturnFunction', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanSuspiciousValueComparison', 'PhanTypeArraySuspiciousNullable', 'PhanTypeInvalidDimOffset', 'PhanTypeInvalidLeftOperandOfBitwiseOp', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeInvalidRightOperandOfAdd', 'PhanTypeInvalidRightOperandOfBitwiseOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentInternalProbablyReal', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeNonVarPassByRef', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredFunction', 'PhanUndeclaredVariable', 'PhanUndeclaredVariableDim'],
78+
],
79+
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
80+
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
81+
];

.phan/config.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Phan configuration for WP Super Cache.
4+
*/
5+
6+
return [
7+
'minimum_target_php_version' => '7.2',
8+
'target_php_version' => '8.5',
9+
10+
'backward_compatibility_checks' => false,
11+
'enable_class_alias_support' => false,
12+
'redundant_condition_detection' => true,
13+
14+
'directory_list' => [
15+
'.',
16+
],
17+
18+
'file_list' => [
19+
__DIR__ . '/stubs/amp-stubs.php',
20+
],
21+
22+
'exclude_analysis_directory_list' => [
23+
'vendor/',
24+
'node_modules/',
25+
'tests/e2e/node_modules/',
26+
'jetpack_vendor/',
27+
],
28+
29+
'autoload_internal_extension_signatures' => [],
30+
31+
'stubs' => [
32+
'vendor/php-stubs/wordpress-stubs/wordpress-stubs.php',
33+
'vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php',
34+
],
35+
36+
'plugins' => [
37+
'AddNeverReturnTypePlugin',
38+
'DuplicateArrayKeyPlugin',
39+
'DuplicateExpressionPlugin',
40+
'LoopVariableReusePlugin',
41+
'PHPUnitNotDeadCodePlugin',
42+
'PregRegexCheckerPlugin',
43+
'RedundantAssignmentPlugin',
44+
'SimplifyExpressionPlugin',
45+
'UnreachableCodePlugin',
46+
'UseReturnValuePlugin',
47+
'UnusedSuppressionPlugin',
48+
],
49+
];

0 commit comments

Comments
 (0)