Variable PACK_CONSISTENCY_PHPConst
PACK_CONSISTENCY_PHP: "\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n$fixed = [];\n// loadLegacyIncludes() runs from preHandle(), not boot(), so a kernel booted to run this and\n// nothing else has no module_config_sort() -- which is what ModuleInstaller::install() calls.\n// Measured on a deployed free site: every firstrun reported\n// 'module-failed:Call to undefined function module_config_sort()' and the driver module was\n// never installed, so system_requirements() told the owner to install it by hand\ntry {\n\t$kernel = $GLOBALS['__pw_kernel'] ?? null;\n\tif ($kernel !== null && method_exists($kernel, 'loadLegacyIncludes')) {\n\t\t$kernel->loadLegacyIncludes();\n\t}\n\t// and the router rebuild inside install() builds a RequestContext from the current request,\n\t// so one has to be on the stack; the same trio the enable path already sets up\n\t$stack = Drupal::service('request_stack');\n\tif ($stack->getCurrentRequest() === null) {\n\t\t$stack->push(Request::create('/', 'GET'));\n\t}\n\t// hook_modules_installed reaches update_storage_clear(), a plain function in update.module,\n\t// and a bare boot has loaded no .module file at all\n\tDrupal::moduleHandler()->loadAll();\n} catch (Throwable $e) {\n\t$fixed[] = 'includes-failed:' . substr($e->getMessage(), 0, 120);\n}\n// ONE install() for both modules: each call rebuilds the container and the router, and on a\n// migrated 160-module site two rebuilds took the claim to 25 s of CPU against a 30 s limit\n$want = [];\ntry {\n\t$driverModule = Drupal::database()->getProvider();\n\tif (\n\t\t$driverModule &&\n\t\t$driverModule !== 'core' &&\n\t\t!Drupal::moduleHandler()->moduleExists($driverModule)\n\t) {\n\t\t$want[$driverModule] = 'module';\n\t}\n} catch (Throwable $e) {\n\t$fixed[] = 'module-failed:' . substr($e->getMessage(), 0, 120);\n}\n// a migrated database never had the platform module; without it core's requirements for a php.ini\n// this runtime does not have stay errors, and every database update run halts on them\ntry {\n\t// the config row, as the installer itself reads it; a container can list a module config dropped\n\t$enabled = Drupal::config('core.extension')->get('module') ?: [];\n\tif (\n\t\t!isset($enabled['drupflare']) &&\n\t\tisset(Drupal::service('extension.list.module')->getList()['drupflare'])\n\t) {\n\t\t$want['drupflare'] = 'drupflare';\n\t}\n} catch (Throwable $e) {\n\t$fixed[] = 'drupflare-failed:' . substr($e->getMessage(), 0, 120);\n}\nif ($want) {\n\ttry {\n\t\tDrupal::service('module_installer')->install(array_keys($want));\n\t\t$out['packConsistencyInstalls'] = ($out['packConsistencyInstalls'] ?? 0) + 1;\n\t\tforeach (array_keys($want) as $module) {\n\t\t\t$fixed[] = 'module:' . $module;\n\t\t}\n\t} catch (Throwable $e) {\n\t\tforeach ($want as $kind) {\n\t\t\t$fixed[] = $kind . '-failed:' . substr($e->getMessage(), 0, 120);\n\t\t}\n\t}\n}\n\ntry {\n\t$udm = Drupal::service('entity.definition_update_manager');\n\t$changes = $udm->getChangeList();\n\tforeach ($changes as $entityTypeId => $change) {\n\t\tforeach ($change['field_storage_definitions'] ?? [] as $fieldName => $op) {\n\t\t\t// 1 is CREATE; an UPDATE or DELETE is a schema change this must not perform silently\n\t\t\tif ((int) $op !== 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$definition =\n\t\t\t\tDrupal::service('entity_field.manager')->getFieldStorageDefinitions($entityTypeId)[\n\t\t\t\t\t$fieldName\n\t\t\t\t] ?? null;\n\t\t\tif ($definition === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$udm->installFieldStorageDefinition(\n\t\t\t\t$fieldName,\n\t\t\t\t$entityTypeId,\n\t\t\t\t$definition->getProvider(),\n\t\t\t\t$definition,\n\t\t\t);\n\t\t\t$fixed[] = 'field:' . $entityTypeId . '.' . $fieldName;\n\t\t}\n\t}\n} catch (Throwable $e) {\n\t$fixed[] = 'field-failed:' . substr($e->getMessage(), 0, 120);\n}\n// THE TOOLKIT SHIPS AND WAS NEVER SELECTED. system.image says gd, which is not in this build, so\n// Drupal reports \"No image toolkit is configured\" while cfw_images sits in the packed module\n// unused. It is a real toolkit rather than a stub -- getimagesize() is ext-standard and needs no\n// gd, so dimensions stay correct and resizing defers to delivery.\n//\n// WITH NO TOOLKIT AT ALL, /user/register AND /user/*/edit ARE A WSOD. ImageFactory resolves the\n// id from the AVAILABLE toolkits, so with none it holds NULL and getSupportedExtensions() raises\n// PluginNotFoundException on the empty id -- which the user picture field hits on every account\n// form. Found by opening the sign-up page in a browser.\ntry {\n\t$manager = Drupal::service('image.toolkit.manager');\n\t// the definitions are cached from before this module was enabled, so a read without this sees\n\t// only gd and the branch below silently declines to fix anything\n\t$manager->clearCachedDefinitions();\n\t$defined = array_keys($manager->getDefinitions());\n\t$available = array_keys($manager->getAvailableToolkits());\n\t$imageConfig = Drupal::configFactory()->getEditable('system.image');\n\t$selected = $imageConfig->get('toolkit');\n\tif (in_array($selected, $available, true)) {\n\t\t// already usable, nothing to do\n\t} elseif (in_array('cfw_images', $available, true)) {\n\t\t$imageConfig->set('toolkit', 'cfw_images')->save();\n\t\t$fixed[] = 'toolkit:cfw_images';\n\t} else {\n\t\t// NOT silent: with no available toolkit every account form raises, so a repair that cannot\n\t\t// run has to say so rather than report an empty list\n\t\t$fixed[] =\n\t\t\t'toolkit-unavailable:defined=' .\n\t\t\timplode(',', $defined) .\n\t\t\t';available=' .\n\t\t\timplode(',', $available);\n\t}\n} catch (Throwable $e) {\n\t$fixed[] = 'toolkit-failed:' . substr($e->getMessage(), 0, 120);\n}\n$out['packConsistency'] = $fixed;\n"