class ExtensionManager

Properties

protected $extensions

Methods

__construct(SettingsRepositoryInterface $config, Paths $paths, Container $container, Migrator $migrator, Dispatcher $dispatcher, Filesystem $filesystem)

No description

Collection
getExtensions()

No description

Collection
getExtensionsById(array $ids)

No description

Extension|null
getExtension(string $name)

No description

void
enable(string $name)

No description

void
disable(string $name)

No description

void
uninstall(string $name)

No description

void
publishAssets(Extension $extension)

<p>Copy the assets from an extension's assets directory into public view.</p>

void
unpublishAssets(Extension $extension)

<p>Delete an extension's assets from public view.</p>

string
getAsset(Extension $extension, string $path)

<p>Get the path to an extension's published asset.</p>

Cloud
getAssetsFilesystem()

<p>Get an instance of the <code>assets</code> filesystem.</p>

int|null
migrate(Extension $extension, string $direction = 'up')

<p>Runs the database migrations for the extension.</p>

void
migrateDown(Extension $extension)

<p>Runs the database migrations to reset the database to its old state.</p>

getMigrator()

<p>The database migrator.</p>

array
getEnabledExtensions()

No description

void
extend(Container $container)

<p>Call on all enabled extensions to extend the Flarum application.</p>

array
getEnabled()

<p>The id's of the enabled extensions.</p>

void
setEnabledExtensions(array $enabledExtensions)

<p>Persist the currently enabled extensions.</p>

bool
isEnabled(string $extension)

No description

static array
pluckTitles(array $extensions)

<p>Returns the titles of the extensions passed.</p>

static array
resolveExtensionOrder(array $extensionList)

<p>Sort a list of extensions so that they are properly resolved in respect to order.</p>

extensionFromJson(array $package, string $path)

No description

array|null
subExtensionConfsFromJson(array $package, string $packagePath)

No description

Details

__construct(SettingsRepositoryInterface $config, Paths $paths, Container $container, Migrator $migrator, Dispatcher $dispatcher, Filesystem $filesystem)

Parameters

SettingsRepositoryInterface $config
Paths $paths
Container $container
Migrator $migrator
Dispatcher $dispatcher
Filesystem $filesystem

Collection getExtensions()

Return Value

Collection

Collection getExtensionsById(array $ids)

Parameters

array $ids

Return Value

Collection

Extension|null getExtension(string $name)

Parameters

string $name

Return Value

Extension|null

void enable(string $name)

Parameters

string $name

Return Value

void

void disable(string $name)

Parameters

string $name

Return Value

void

void uninstall(string $name)

Parameters

string $name

Return Value

void

protected void publishAssets(Extension $extension)

<p>Copy the assets from an extension's assets directory into public view.</p>

Parameters

Extension $extension

Return Value

void

protected void unpublishAssets(Extension $extension)

<p>Delete an extension's assets from public view.</p>

Parameters

Extension $extension

Return Value

void

string getAsset(Extension $extension, string $path)

<p>Get the path to an extension's published asset.</p>

Parameters

Extension $extension
string $path

Return Value

string

protected Cloud getAssetsFilesystem()

<p>Get an instance of the <code>assets</code> filesystem.</p>

<p>This is resolved dynamically because Flarum's filesystem configuration might not be booted yet when the ExtensionManager singleton initializes.</p>

Return Value

Cloud

int|null migrate(Extension $extension, string $direction = 'up')

<p>Runs the database migrations for the extension.</p>

Parameters

Extension $extension
string $direction

Return Value

int|null

void migrateDown(Extension $extension)

<p>Runs the database migrations to reset the database to its old state.</p>

Parameters

Extension $extension

Return Value

void

Migrator getMigrator()

<p>The database migrator.</p>

Return Value

Migrator

array getEnabledExtensions()

Return Value

array

void extend(Container $container)

<p>Call on all enabled extensions to extend the Flarum application.</p>

Parameters

Container $container

Return Value

void

array getEnabled()

<p>The id's of the enabled extensions.</p>

Return Value

array

protected void setEnabledExtensions(array $enabledExtensions)

<p>Persist the currently enabled extensions.</p>

Parameters

array $enabledExtensions

Return Value

void

Exceptions

CircularDependenciesException

bool isEnabled(string $extension)

Parameters

string $extension

Return Value

bool

static array pluckTitles(array $extensions)

<p>Returns the titles of the extensions passed.</p>

Parameters

array $extensions

Return Value

array

static array resolveExtensionOrder(array $extensionList)

<p>Sort a list of extensions so that they are properly resolved in respect to order.</p>

<p>Effectively just topological sorting.</p>

Parameters

array $extensionList

Return Value

array

protected Extension extensionFromJson(array $package, string $path)

Parameters

array $package
string $path

Return Value

Extension

protected array|null subExtensionConfsFromJson(array $package, string $packagePath)

Parameters

array $package
string $packagePath

Return Value

array|null