| @@ -224,9 +224,16 @@ | ||
| 224 | 224 | # execution follows exactly the path it does today, and an extra callback |
| 225 | 225 | # on a WPGraphQL schema build is an observable difference even when it |
| 226 | 226 | # returns immediately. The option read this costs is memoised and the |
| 227 | 227 | # plugin already reads that option several times per request. |
| 228 | - if (!Metasync_Headless_Config::is_enabled()) { | |
| 228 | + # | |
| 229 | + # The class_exists leg is the update-window case: this file and the | |
| 230 | + # config class are separate files in the same auto-update, and WordPress | |
| 231 | + # copies them one at a time. A request landing between the two copies | |
| 232 | + # used to fatal here on every front-end load — the classmap cannot | |
| 233 | + # autoload a file that is not on disk yet. Degrade to the no-headless | |
| 234 | + # path instead; the site keeps serving until the update finishes. | |
| 235 | + if (!class_exists('Metasync_Headless_Config') || !Metasync_Headless_Config::is_enabled()) { | |
| 229 | 236 | return; |
| 230 | 237 | } |
| 231 | 238 | |
| 232 | 239 | add_action('graphql_register_types', array(__CLASS__, 'register')); |
| @@ -294,15 +301,17 @@ | ||
| 294 | 301 | * |
| 295 | 302 | * The headless check happens here rather than at hook time so switching the |
| 296 | 303 | * mode takes effect on the next request instead of needing a reload. With |
| 297 | 304 | * the mode off nothing is registered and the schema is byte-identical to a |
| 298 | - * site without this plugin. | |
| 305 | + * site without this plugin. The class_exists leg mirrors init(): during an | |
| 306 | + * auto-update the file set on disk can be mixed, and a callback that only | |
| 307 | + * exists to be inert must survive landing in one. | |
| 299 | 308 | * |
| 300 | 309 | * @return void |
| 301 | 310 | */ |
| 302 | 311 | public static function register() |
| 303 | 312 | { |
| 304 | - if (!Metasync_Headless_Config::is_enabled()) { | |
| 313 | + if (!class_exists('Metasync_Headless_Config') || !Metasync_Headless_Config::is_enabled()) { | |
| 305 | 314 | return; |
| 306 | 315 | } |
| 307 | 316 | |
| 308 | 317 | if (!function_exists('register_graphql_object_type') || !function_exists('register_graphql_field')) { |