Variable UPDB_PLAN_PHPConst
UPDB_PLAN_PHP: "\nuse Drupal\\Core\\Extension\\Requirement\\RequirementSeverity;\n\n// __CFW_FIBER_SHIM__\nchdir('/drupal');\n\n$out = ['ok' => false, 'updates' => [], 'postUpdates' => []];\n\ntry {\n\t// __CFW_UPDB_PREAMBLE__\n\n\t$reg = Drupal::service('update.update_hook_registry');\n\t$postReg = Drupal::service('update.post_update_registry');\n\n\t$out['drupalVersion'] = Drupal::VERSION;\n\t$out['minimumSchemaVersion'] = Drupal::CORE_MINIMUM_SCHEMA_VERSION;\n\n\t// The digest: names only, sorted, so it is stable across two boots of the same\n\t// tree and changes the moment an update is added or removed.\n\t$defined = get_defined_functions()['user'];\n\t$updateFns = [];\n\tforeach ($defined as $f) {\n\t\tif (preg_match('/_update_\\d+$/', $f) || strpos($f, '_post_update_') !== false) {\n\t\t\t$updateFns[] = $f;\n\t\t}\n\t}\n\tsort($updateFns);\n\t$out['codeId'] = sha1(Drupal::VERSION . '|' . implode(',', $updateFns));\n\t$out['codeFunctionCount'] = count($updateFns);\n\n\tif (__CFW_CHECK_REQUIREMENTS__) {\n\t\ttry {\n\t\t\t$reqs = update_check_requirements();\n\t\t\t$worst = RequirementSeverity::maxSeverityFromRequirements($reqs);\n\t\t\t$out['severity'] = $worst->value;\n\t\t\t$out['severityName'] = $worst->name;\n\t\t\t$errors = [];\n\t\t\t$warnings = [];\n\t\t\tforeach ($reqs as $key => $r) {\n\t\t\t\t$s = $r['severity'] ?? null;\n\t\t\t\tif (!($s instanceof RequirementSeverity)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$text = strip_tags((string) ($r['description'] ?? ($r['value'] ?? '')));\n\t\t\t\tif ($s === RequirementSeverity::Error) {\n\t\t\t\t\t$errors[$key] = substr($text, 0, 300);\n\t\t\t\t} elseif ($s === RequirementSeverity::Warning) {\n\t\t\t\t\t$warnings[$key] = substr($text, 0, 300);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$out['requirementErrors'] = $errors;\n\t\t\t$out['requirementWarnings'] = $warnings;\n\t\t} catch (Throwable $e) {\n\t\t\t// Reported, never swallowed: a plan built without a requirements check is a\n\t\t\t// different plan and the caller has to be able to refuse it.\n\t\t\t$out['requirementsError'] = get_class($e) . ': ' . $e->getMessage();\n\t\t}\n\t} else {\n\t\t$out['requirementsSkipped'] = true;\n\t}\n\n\t$list = update_get_update_list();\n\t$start = [];\n\t$listWarnings = [];\n\tforeach ($list as $module => $info) {\n\t\tif (isset($info['warning'])) {\n\t\t\t$listWarnings[$module] = strip_tags((string) $info['warning']);\n\t\t}\n\t\tif (isset($info['start'])) {\n\t\t\t$start[$module] = $info['start'];\n\t\t}\n\t}\n\t$out['warnings'] = $listWarnings;\n\t$out['startingUpdates'] = $start;\n\n\t$resolved = update_resolve_dependencies($start);\n\n\t$depMap = [];\n\tforeach ($resolved as $fn => $data) {\n\t\t$depMap[$fn] = !empty($data['reverse_paths']) ? array_keys($data['reverse_paths']) : [];\n\t}\n\n\t// seedSchema reproduces DbUpdateController line 636 exactly: the first update of\n\t// each module forces the installed version to number-1 so the run starts where\n\t// the plan says, whatever the recorded version happens to be. Later updates of\n\t// the same module instead carry expectSchema, the previous update's number, which\n\t// is the value setInstalledVersion() left behind -- and which the JS precondition\n\t// gate refuses to proceed without.\n\t$pendingSeed = $start;\n\t$lastNumber = [];\n\t$disallowed = [];\n\tforeach ($resolved as $fn => $data) {\n\t\t$module = $data['module'];\n\t\t$number = (int) $data['number'];\n\t\tif (empty($data['allowed'])) {\n\t\t\t$disallowed[$fn] = array_values($data['missing_dependencies'] ?? []);\n\t\t\tcontinue;\n\t\t}\n\t\t$unit = [\n\t\t\t'kind' => 'update',\n\t\t\t'fn' => $fn,\n\t\t\t'module' => $module,\n\t\t\t'number' => $number,\n\t\t\t'depMap' => $depMap[$fn] ?? [],\n\t\t\t'seedSchema' => null,\n\t\t\t'expectSchema' => null,\n\t\t];\n\t\tif (isset($pendingSeed[$module])) {\n\t\t\t$unit['seedSchema'] = $number - 1;\n\t\t\tunset($pendingSeed[$module]);\n\t\t} else {\n\t\t\t$unit['expectSchema'] = $lastNumber[$module] ?? null;\n\t\t}\n\t\t$lastNumber[$module] = $number;\n\t\t$out['updates'][] = $unit;\n\t}\n\t$out['disallowed'] = $disallowed;\n\n\t$post = [];\n\ttry {\n\t\tforeach ($postReg->getPendingUpdateFunctions() as $fn) {\n\t\t\t$post[] = $fn;\n\t\t}\n\t} catch (Throwable $e) {\n\t\t// RemovedPostUpdateNameException is thrown when a module declares an update\n\t\t// removed in hook_removed_post_updates() while the function still exists. That\n\t\t// is a broken code tree, not a transient error, and it must stop the plan.\n\t\t$out['postUpdateError'] = get_class($e) . ': ' . $e->getMessage();\n\t}\n\t$out['postUpdates'] = $post;\n\n\t$out['installedVersions'] = $reg->getAllInstalledVersions();\n\t$out['counts'] = ['updates' => count($out['updates']), 'postUpdates' => count($post)];\n\t$out['ok'] = !isset($out['postUpdateError']);\n} catch (Throwable $e) {\n\t$out['error'] = get_class($e) . ': ' . $e->getMessage();\n\t$out['trace'] = substr($e->getTraceAsString(), 0, 900);\n}\n\necho json_encode($out);\n"