\ModuleMetrics
Synopsis
class ModuleMetrics
{
- // constants
- const USAGE_TYPE_EXTENSION = 'Extension';
- const USAGE_TYPE_DATA_OBJECT = 'DataObject';
- const USAGE_TYPE_AUGMENT_DATABASE = 'AugmentDatabase';
- const USAGE_TYPE_NO_DB_INTERACTION = 'NoDBInteraction';
- // members
- protected $siteName;
- private static ModuleMetrics $instance;
- protected $result;
- protected array $specialModules = ;
- // methods
- public static ModuleMetrics inst()
- public void setResult()
- public void getResult()
- public void addDataObjectAndExtensionInfo()
- public void addDatabaseInfo()
- public string getModuleName()
- public array setModules()
- public string getSiteName()
- public void setModuleUsage()
- public void determineAugmentDatabaseExtensionUsage()
- public void determineDataObjectUsage()
- public void determineDataExtensionUsage()
- public void usageBasedOnColumnValues()
- public string toJSON()
- public array resultAsArray()
- public ArrayList resultAsList()
Constants
Name | Value |
---|---|
USAGE_TYPE_EXTENSION | 'Extension' |
USAGE_TYPE_DATA_OBJECT | 'DataObject' |
USAGE_TYPE_AUGMENT_DATABASE | 'AugmentDatabase' |
USAGE_TYPE_NO_DB_INTERACTION | 'NoDBInteraction' |
Members
private
- $instance — ModuleMetrics
protected
- $result
—
array
Contains the results - $siteName
- $specialModules
—
array
This is a map of modules which mutates the DB through DataExtension->augmentDatabase method.
Methods
public
- addDataObjectAndExtensionInfo() — Sets information about all DataObjects per module, excluding test DataObjects.
- addDatabaseInfo()
- determineAugmentDatabaseExtensionUsage() — Cycles through all DataObjects to determine if they have a specific data-extension which overrides DataExtension->augmentDatabase method. If it does, it checks whether a table exists containing a suffix introduced in the method. If it does, it checks if that table has any rows.
- determineDataExtensionUsage() — Checks if any of the fields introduced by a DataExtension within $moduleName has a non-null value. If it does then it is assumed to be in use.
- determineDataObjectUsage() — Checks if any of the DataObjects introduced by $moduleName has any records and returns true.
- getModuleName() — Gets the module name for a given class
- getResult()
- getSiteName() — Returns the website name
- inst() — Returns a singleton of this object.
- resultAsArray()
- resultAsList()
- setModuleUsage() — Determines if a module is in use or not.
- setModules() — Sets a list of all modules within this SilverStripe installation
- setResult()
- toJSON() — Returns $this->result as json
- usageBasedOnColumnValues() — Determines if a module is in use based by checking for a valid value in any new field introduced.