Drupal 8  8.0.2
UpdateRegistry Class Reference

Public Member Functions

 __construct ($root, $site_path, array $enabled_modules, KeyValueStoreInterface $key_value, $include_tests=NULL)
 
 getPendingUpdateFunctions ()
 
 getPendingUpdateInformation ()
 
 registerInvokedUpdates (array $function_names)
 
 getModuleUpdateFunctions ($module_name)
 
 filterOutInvokedUpdatesByModule ($module)
 

Protected Member Functions

 getAvailableUpdateFunctions ()
 
 loadUpdateFiles (array $module_extensions)
 
 loadUpdateFile (Extension $module)
 
 scanExtensionsAndLoadUpdateFiles ()
 

Protected Attributes

 $updateType = 'post_update'
 
 $root
 
 $logFilename
 
 $enabledModules
 
 $keyValue
 
 $includeTests = NULL
 
 $sitePath
 

Detailed Description

Provides all and missing update implementations.

Note: This registry is specific to a type of updates, like 'post_update' as example.

It therefore scans for functions named like the type of updates, so it looks like MODULE_UPDATETYPE_NAME() with NAME being a machine name.

Constructor & Destructor Documentation

__construct (   $root,
  $site_path,
array  $enabled_modules,
KeyValueStoreInterface  $key_value,
  $include_tests = NULL 
)

Constructs a new UpdateRegistry.

Parameters
string$rootThe app root.
string$site_pathThe site path.
string[]$enabled_modules A list of enabled modules.
\Drupal\Core\KeyValueStore\KeyValueStoreInterface$key_valueThe key value store.
bool | NULL$include_tests(optional) A flag whether to include tests in the scanning of modules.

References Drupal\keyValue(), and Drupal\root().

Here is the call graph for this function:

Member Function Documentation

filterOutInvokedUpdatesByModule (   $module)

Filters out already executed update functions by module.

Parameters
string$moduleThe module name.

References Drupal\keyValue().

Here is the call graph for this function:

getAvailableUpdateFunctions ( )
protected

Gets all available update functions.

Returns
callable[] A list of update functions.

Referenced by UpdateRegistry\getModuleUpdateFunctions(), and UpdateRegistry\getPendingUpdateFunctions().

Here is the caller graph for this function:

getModuleUpdateFunctions (   $module_name)

Returns all available updates for a given module.

Parameters
string$module_nameThe module name.
Returns
callable[] A list of update functions.

References UpdateRegistry\getAvailableUpdateFunctions(), and UpdateRegistry\scanExtensionsAndLoadUpdateFiles().

Here is the call graph for this function:

getPendingUpdateFunctions ( )

Find all update functions that haven't been executed.

Returns
callable[] A list of update functions.

References UpdateRegistry\getAvailableUpdateFunctions(), Drupal\keyValue(), and UpdateRegistry\scanExtensionsAndLoadUpdateFiles().

Referenced by UpdateRegistry\getPendingUpdateInformation().

Here is the call graph for this function:

Here is the caller graph for this function:

getPendingUpdateInformation ( )

Returns a list of all the pending updates.

Returns
array[] An associative array keyed by module name which contains all information about database updates that need to be run, and any updates that are not going to proceed due to missing requirements.

The subarray for each module can contain the following keys:

  • start: The starting update that is to be processed. If this does not exist then do not process any updates for this module as there are other requirements that need to be resolved.
  • pending: An array of all the pending updates for the module including the description from source code comment for each update function. This array is keyed by the update name.

References UpdateRegistry\getPendingUpdateFunctions().

Here is the call graph for this function:

loadUpdateFile ( Extension  $module)
protected

Loads the {$this->updateType}.php file for a given extension.

Parameters
\Drupal\Core\Extension\Extension$moduleThe extension of the module to load its file.

References Extension\getName(), Extension\getPath(), and Drupal\root().

Referenced by UpdateRegistry\loadUpdateFiles().

Here is the call graph for this function:

Here is the caller graph for this function:

loadUpdateFiles ( array  $module_extensions)
protected

Loads all update files for a given list of extension.

Parameters
\Drupal\Core\Extension\Extension[]$module_extensions The extensions used for loading.

References UpdateRegistry\loadUpdateFile().

Referenced by UpdateRegistry\scanExtensionsAndLoadUpdateFiles().

Here is the call graph for this function:

Here is the caller graph for this function:

registerInvokedUpdates ( array  $function_names)

Registers that update fucntions got executed.

Parameters
string[]$function_names The executed update functions.
Returns
$this

References Drupal\keyValue().

Here is the call graph for this function:

scanExtensionsAndLoadUpdateFiles ( )
protected

Scans all module + profile extensions and load the update files.

References UpdateRegistry\loadUpdateFiles(), and Drupal\root().

Referenced by UpdateRegistry\getModuleUpdateFunctions(), and UpdateRegistry\getPendingUpdateFunctions().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: