API / Minn\Content / Inventory

Inventory final readonly class

Minn\Content\Inventory · public/minn/src/Minn/Content/Inventory.php · 253 lines

Plugins, themes, must-use plugins, and drop-ins as they sit on disk. The shapes match `wp plugin list` / `wp theme list` captured from the reference: name is the directory (or the drop-in filename), title and version come from the file headers, status from the options.

Constants and properties

privateDROPINS = array ( 0 => 'advanced-cache.php', 1 => 'db.php', 2 => 'db-error.php', 3 => 'fatal-error-handler.php', 4 => 'install.php', 5 => 'maintenance.php', 6 => 'object-cache.php', 7 => 'php-error.php', 8 => 'sunrise.php', )

Drop-in filenames at wp-content/ that hosting tools treat as WordPress drop-ins.

constKNOWN_DROPINS = array ( 'advanced-cache.php' => array ( 0 => 'Advanced caching plugin.', 1 => 'WP_CACHE', ), 'db.php' => array ( 0 => 'Custom database class.', 1 => true, ), 'db-error.php' => array ( 0 => 'Custom database error message.', 1 => true, ), 'install.php' => array ( 0 => 'Custom installation script.', 1 => true, ), 'maintenance.php' => array ( 0 => 'Custom maintenance message.', 1 => true, ), 'object-cache.php' => array ( 0 => 'External object cache.', 1 => true, ), 'php-error.php' => array ( 0 => 'Custom PHP error message.', 1 => true, ), 'fatal-error-handler.php' => array ( 0 => 'Custom PHP fatal error handler.', 1 => true, ), )

The drop-ins a single site recognises, in the reference's order: the file => its description and the constant that must be true for it to load (true when nothing gates it).

privatereadonly string $contentDir

Promoted from the constructor.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

Public

new__construct(string $contentDir, Minn\Content\Site $site)#
methodplugins(): array#

Regular plugins, then must-use, then drop-ins, each group sorted by name.

@return list<array<string, mixed>>
methodmustUse(): array#

The mu-plugins folder's PHP files, each with its header.

@return list<array<string, mixed>>
methoddropins(): array#

The drop-in files present in wp-content.

@return list<array<string, mixed>>
methodthemes(): array#

Every theme folder with its style.css header.

@return list<array<string, mixed>>
methodpluginFiles(): array#

Every regular plugin's main file: relative "dir/file.php" (or "file.php" for a single-file plugin) to its absolute path.

@return array<string, string>

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateregularPlugins(): array#
@return list<array<string, mixed>>
privatemainPluginFile(string $dir, string $slug): ?string#
privateitem(string $name, string $title, string $status, string $version, string|false $update, bool $auto): array#
@return array<string, mixed>