AvailableVariablesUpdater
class AvailableVariablesUpdater (View source)
Constants
FLAG_NONE |
Operation flag: no operations. |
FLAG_SIMULATE |
Operation flag: only simulate operations, don't persist anything. |
FLAG_REMOVE_INVALID |
Operation flag: delete invalid values. |
FLAG_REMOVE_DUPLICATED |
Operation flag: delete duplicated values. |
FLAG_REMOVE_UNUSED |
Operation flag: delete values present in the database but not in any preset. |
FLAG_ADD |
Operation flag: add values present in presets but not in the database. |
FLAG_UPDATE |
Operation flag: update values present in presets and in the database, but with wrong definition. |
Properties
protected Connection | $db | The database connection. |
|
protected Repository | $config | The application configuration repository. |
|
private string[]|true[]|null | $ignoredValues | The list of values to be ignored (array keys are the variable names, array values are the value class name, or true for any class). |
Methods
Get the list of values to be ignored.
Set the list of values to be ignored.
Get the list of the IDs of the currently used variable lists and the associated preset.
Build the list of all the style values defined by a theme.
List all the values of a list of a variables.
Unserialize a serialized Style Customizer value.
Remove a value from the database.
Process the list of values, filtering out the invalid ones.
Delete the duplicated values.
Delete the unused values.
Check if a value is not used.
Check if some values needs to be updated.
Create a new Value instance, if it needs to be fixed.
Create a new TypeValue instance, if it needs to be fixed.
Check if some values needs to be added.
Check if a value found in a preset should be added to the currently used values.
Check if two variables are the values of the same variable.
Details
__construct(Connection $db, Repository $config)
Initialize the instance.
Result[]
fixThemes(int $flags)
Fix the values of every page theme.
protected string[]|true[]
getIgnoredValues()
Get the list of values to be ignored.
protected $this
setIgnoredValues(array $value)
Set the list of values to be ignored.
protected bool
shouldIgnoreValue(Value $value)
Check if a value should be ignored.
protected Generator|string[]
listValueListIDs(Theme $theme)
Get the list of the IDs of the currently used variable lists and the associated preset.
protected ValueList
buildThemeValueList(Theme $theme, array $presets, string $presetHandle, Result $fixResult)
Build the list of all the style values defined by a theme.
protected Value[]|string[]
listValues(int $valueListID)
List all the values of a list of a variables.
protected Value|string
unserializeValue(string $serializedValue)
Unserialize a serialized Style Customizer value.
protected int
addValue(int $valueListID, Value $value)
Save a new variable to the database.
protected
updateValue(int $valueID, Value $value)
Update a value saved in the database.
protected
deleteValue(int $valueID)
Remove a value from the database.
protected Value[]
processInvalid(array $currentValues, Result $fixResult, bool $delete, bool $simulate)
Process the list of values, filtering out the invalid ones.
protected Value[]
deleteDuplicated(array $currentValues, ValueList $themeValueList, Result $fixResult, bool $simulate)
Delete the duplicated values.
protected Value[]
deleteUnused(array $currentValues, ValueList $themeValueList, Result $fixResult, bool $simulate)
Delete the unused values.
protected bool
isValueUnused(Value $value, ValueList $themeValueList, Result $fixResult)
Check if a value is not used.
protected Value[]
updateCurrentValues(array $currentValues, ValueList $themeValueList, Result $fixResult, bool $simulate)
Check if some values needs to be updated.
protected Value|null
buildUpdatedValue(Value $value, ValueList $themeValueList)
Create a new Value instance, if it needs to be fixed.
protected TypeValue|null
buildUpdatedTypeValue(TypeValue $value, ValueList $themeValueList)
Create a new TypeValue instance, if it needs to be fixed.
protected Value[]
addNewValues(array $currentValues, ValueList $themeValueList, int $valueListID, Result $fixResult, bool $simulate)
Check if some values needs to be added.
protected bool
shouldAddValue(Value $presetValue, array $currentValues)
Check if a value found in a preset should be added to the currently used values.