Commit fe84056
authored
[codex] Fix Push MD toolkit loading and clone blockers (#49)
## Summary
Fixes the Push MD activation and clone blockers found while testing on
WordPress.com staging.
- Makes PHP Toolkit standalone function files safe to load when another
plugin has already loaded the same toolkit functions.
- Updates Push MD's toolkit bootstrap paths to avoid Composer
autoload-file redeclaration crashes.
- Returns Git protocol error responses for `/info/refs` failures instead
of opaque REST 500s.
- Exports WordPress posts/pages with empty slugs using stable ID-based
fallback paths, e.g. `post/post-4937.md`, to avoid `post/.md`
collisions.
- Keeps those fallback paths stable while content remains slugless,
without writing fallback names back into WordPress slugs; stale fallback
pushes are rejected once WordPress assigns a real slug.
- Makes the Push MD bootstrap compatibility tests avoid Windows
`cmd.exe` quoting failures.
## Root Cause
WordPress.com SH (`wpcomsh`) already bundles
`wp-php-toolkit/filesystem`, so Push MD's bundled toolkit could
redeclare namespaced helper functions during activation. After
activation was fixed, authenticated clone exposed two runtime issues:
`/info/refs` errors were surfaced as REST 500s, and draft posts with
empty slugs collided on the same export path.
The follow-up fallback-path fix avoids treating generated filenames such
as `post/post-4937.md` as desired WordPress slugs. If WordPress later
assigns a canonical slug, Push MD now asks the user to pull the
slug-based path before editing rather than silently moving content back
to the generated fallback path.
The Windows CI failure came from passing inline PHP snippets through
`php -r` inside a shell command. The tests now write a temporary PHP
script and invoke PHP with shell bypassing enabled on Windows.
## Validation
- `vendor/bin/phpunit -c phpunit.xml`
- `vendor/bin/phpunit -c phpunit.xml
components/Filesystem/Tests/FunctionsTest.php`
- `vendor/bin/phpunit -c phpunit.xml --filter
PMD_Bootstrap_Compatibility_Test plugins/push-md/Tests/`
- `vendor/bin/phpunit -c phpunit.xml plugins/push-md/Tests/`
- `vendor/bin/phpunit -c phpunit.xml components/Filesystem/Tests/
components/Git/Tests/ components/Zip/Tests/
components/DataLiberation/Tests/ components/Encoding/Tests/`
- `composer test`
- `php -l plugins/push-md/class-pmd-plugin.php && php -l
plugins/push-md/Tests/ExportPathTest.php`
- `php -l plugins/push-md/Tests/BootstrapCompatibilityTest.php && php -l
components/Filesystem/Tests/FunctionsTest.php`
- `vendor/bin/phpcs -d memory_limit=1G
plugins/push-md/class-pmd-plugin.php
plugins/push-md/Tests/ExportPathTest.php`
- `vendor/bin/phpcs -d memory_limit=1G
plugins/push-md/Tests/BootstrapCompatibilityTest.php
components/Filesystem/Tests/FunctionsTest.php`
- `git diff --check`
- rebuilt `dist/plugins/push-md.zip` and
`/Users/artpi/Desktop/push-md.zip`
- installed/tested on staging and confirmed `git clone` succeeds into
`~/Desktop/site-title`
Note: repo-wide `composer lint` still exits on pre-existing
warning-level findings outside this change; scoped PHPCS for touched
files passes.1 parent b8b0072 commit fe84056
16 files changed
Lines changed: 1280 additions & 799 deletions
File tree
- components
- DataLiberation/URL
- Encoding
- Filesystem
- Tests
- Git
- Zip
- plugins/push-md
- Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
94 | 97 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 124 | | |
127 | 125 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
149 | 147 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
159 | 165 | | |
160 | | - | |
161 | | - | |
| 166 | + | |
162 | 167 | | |
163 | | - | |
| 168 | + | |
| 169 | + | |
164 | 170 | | |
0 commit comments