Heratio Framework API Reference

ExtensionProtection
in package

Extension Protection Service

Handles protection rules for plugins:

  • Core plugins cannot be disabled
  • Locked plugins cannot be modified
  • Plugins with records cannot be disabled without force

Uses direct PDO connection (works in CLI and web context)

Table of Contents

Methods

canDisable()  : array{can_disable: bool, reason: string|null, record_count: int}
Check if a plugin can be disabled.
getAllProtectionStatus()  : array<string, array{can_disable: bool, reason: string|null, record_count: int, is_enabled: bool}>
Get all plugins with their protection status.
getProtectionMessage()  : string|null
Get protection status message for display.
getRecordCount()  : int
Get the record count for a plugin.
hasRecords()  : bool
Check if plugin has any associated records.
isCoreInDatabase()  : bool
Check if plugin is a core plugin in the database.
isCorePlugin()  : bool
Check if plugin is a core plugin.
isLocked()  : bool
Check if plugin is locked in the database.
setRecordCheckQuery()  : bool
Set record check query for a plugin.

Methods

canDisable()

Check if a plugin can be disabled.

public canDisable(string $pluginName[, bool $force = false ]) : array{can_disable: bool, reason: string|null, record_count: int}
Parameters
$pluginName : string

Plugin name

$force : bool = false

Force disable even with records

Return values
array{can_disable: bool, reason: string|null, record_count: int}

getAllProtectionStatus()

Get all plugins with their protection status.

public getAllProtectionStatus() : array<string, array{can_disable: bool, reason: string|null, record_count: int, is_enabled: bool}>
Return values
array<string, array{can_disable: bool, reason: string|null, record_count: int, is_enabled: bool}>

getProtectionMessage()

Get protection status message for display.

public getProtectionMessage(string $pluginName) : string|null
Parameters
$pluginName : string
Return values
string|null

getRecordCount()

Get the record count for a plugin.

public getRecordCount(string $pluginName) : int
Parameters
$pluginName : string

Plugin name

Return values
int

Number of records (0 if no check query or error)

hasRecords()

Check if plugin has any associated records.

public hasRecords(string $pluginName) : bool
Parameters
$pluginName : string
Return values
bool

isCoreInDatabase()

Check if plugin is a core plugin in the database.

public isCoreInDatabase(string $pluginName) : bool
Parameters
$pluginName : string
Return values
bool

isCorePlugin()

Check if plugin is a core plugin.

public isCorePlugin(string $pluginName) : bool
Parameters
$pluginName : string
Return values
bool

isLocked()

Check if plugin is locked in the database.

public isLocked(string $pluginName) : bool
Parameters
$pluginName : string
Return values
bool

setRecordCheckQuery()

Set record check query for a plugin.

public setRecordCheckQuery(string $pluginName, string $query) : bool
Parameters
$pluginName : string
$query : string
Return values
bool

        
On this page

Search results