Functions

Create an addon to spec.

create_addon(string $file, array $files, string $addon, string $incompatibilities, string $dependencies, string $author, string $organisation, string $version, string $category, string $copyright_attribution, string $licence, string $description, \PATH $dir = 'exports/addons'
package core_addon_management

Parameters

$file

string

Filename to create in exports/addons directory (should end in .tar)

$files

array

List of files to include

$addon

string

Addon name

$incompatibilities

string

Addon incompatibilities (comma-separated)

$dependencies

string

Addon dependencies (comma-separated)

$author

string

Addon author

$organisation

string

Addon organisation

$version

string

Addon version

$category

string

Addon category

$copyright_attribution

string

Addon copyright attribution

$licence

string

Addon licence

$description

string

Addon description

$dir

\PATH

Directory to save to

Find addon dependencies.

find_addon_dependencies_on(string $addon) : array
package core_addon_management

Parameters

$addon

string

The name of the addon

Returns

arrayList of dependencies

Find effective modification date of an addon.

find_addon_effective_mtime(string $addon_name) : \?TIME
package core_addon_management

Parameters

$addon_name

string

The name of the addon

Returns

\?TIMEModification time (null: could not find any files)

Find the icon for an addon.

find_addon_icon(\ID_TEXT $addon_name, boolean $pick_default = true, \?PATH $tar_path = null) : \?string
package core_addon_management

Parameters

$addon_name

\ID_TEXT

Addon name

$pick_default

boolean

Whether to use a default icon if not found

$tar_path

\?PATH

Path to tar file (null: don't look inside a TAR / it's installed already)

Returns

\?stringTheme image URL (may be a "data:" URL rather than a normal URLPATH) (null: not found)

Find all the available addons (addons in imports/addons that are not necessarily installed).

find_available_addons(boolean $installed_too = true) : array
package core_addon_management

Parameters

$installed_too

boolean

Whether to include addons that are installed already

Returns

arrayMaps of maps describing the available addons (filename => details)

Find all the installed addons.

find_installed_addons(boolean $just_non_bundled = false) : array
package core_addon_management

Parameters

$just_non_bundled

boolean

Whether to only return details on on-bundled addons

Returns

arrayMap of maps describing the available addons (addon name => details)

Find the non-bundled addons available on compo.sr.

find_remote_addons() : array
package core_addon_management

Returns

arrayMap of addon ID to addon title

Find updated addons via checking the compo.sr web service.

find_updated_addons() : array
package core_addon_management

Returns

arrayList of addons updated

Find detail addon details.

get_default_addon_details() : array
package core_addon_management

Returns

arrayMap of default addon details

Find whether a particular feature is available to Composr (e.g. it's an addon).

has_feature(\ID_TEXT $dependency) : boolean
package core_addon_management

Parameters

$dependency

\ID_TEXT

Feature name

Returns

booleanWhether it is

Get information for the user relating to an addon that they are intending to install.

inform_about_addon_install(string $file, \?array $also_uninstalling = null, \?array $also_installing = null, boolean $always_return = false) : array
package core_addon_management

Parameters

$file

string

Filename of the addon TAR file

$also_uninstalling

\?array

List of addons that we're currently uninstalling (so dependencies from these are irrelevant). (null: none)

$also_installing

\?array

List of addons that we're currently installing (so dependencies to these are irrelevant). (null: none)

$always_return

boolean

Whether to make sure we always return, rather than possibly bombing out with a dependency management UI

Returns

arrayTriple: warnings, files, addon info array

Get information for the user relating to an addon that they are intending to uninstall.

inform_about_addon_uninstall(string $addon, \?array $also_uninstalling = null, \?array $addon_info = null, boolean $always_return = false) : array
package core_addon_management

Parameters

$addon

string

Name of the addon

$also_uninstalling

\?array

List of addons that we're currently uninstalling (so dependencies from these are irrelevant). (null: none)

$addon_info

\?array

Addon details. (null: load in function)

$always_return

boolean

Whether to make sure we always return, rather than possibly bombing out with a dependency management UI

Returns

arrayPair: warnings, files

Uninstall an addon.

install_addon(string $file, \?array $files = null
package core_addon_management

Parameters

$file

string

Name of the addon TAR file

$files

\?array

The files to install (null: all)

Get info about an addon, simulating an extended version of the traditional Composr-addon database row.

read_addon_info(string $addon, boolean $get_dependencies_on_this = false, \?array $row = null, \?array $ini_info = null) : array
package core_addon_management

Parameters

$addon

string

The name of the addon

$get_dependencies_on_this

boolean

Whether to search for dependencies on this

$row

\?array

Database row (null: lookup via a new query)

$ini_info

\?array

.ini-format info (needs processing) (null: unknown / N/A)

Returns

arrayThe map of details

Reinstall the specified addon.

reinstall_addon_soft(\ID_TEXT $addon, \?array $ini_info = null
package core_addon_management

Parameters

$addon

\ID_TEXT

The addon name

$ini_info

\?array

.ini-format info (needs processing) (null: unknown / N/A)

Uninstall an addon.

uninstall_addon(string $addon) 
package core_addon_management

Parameters

$addon

string

Name of the addon

Completely uninstall the specified addon from the system.

uninstall_addon_soft(\ID_TEXT $addon) 
package core_addon_management

Parameters

$addon

\ID_TEXT

The addon name

Upgrade the specified addon.

upgrade_addon_soft(\ID_TEXT $addon) : integer
package core_addon_management

Parameters

$addon

\ID_TEXT

The addon name

Returns

integer0=No upgrade. -2=Not installed, 1=Upgrade