class BrokenPackage extends Package (View source)

Constants

E_PACKAGE_NOT_FOUND

Error code: Invalid Package.

E_PACKAGE_INSTALLED

Error code: You've already installed that package.

E_PACKAGE_VERSION

Error code: This package requires concrete5 version %s or greater.

E_PACKAGE_DOWNLOAD

Error code: An error occurred while downloading the package.

E_PACKAGE_SAVE

Error code: concrete5 was not able to save the package after download.

E_PACKAGE_UNZIP

Error code: An error occurred while trying to unzip the package.

E_PACKAGE_INSTALL

Error code: An error occurred while trying to install the package.

E_PACKAGE_MIGRATE_BACKUP

Error code: Unable to backup old package directory to %s.

E_PACKAGE_INVALID_APP_VERSION

Error code: This package isn't currently available for this version of concrete5.

E_PACKAGE_THEME_ACTIVE

Error code: This package contains the active site theme, please change the theme before uninstalling.

Properties

protected string $DIR_PACKAGES_CORE

Absolute path to the /concrete/packages directory.

from  Package
protected string $DIR_PACKAGES

Absolute path to the /packages directory.

from  Package
protected string $REL_DIR_PACKAGES_CORE

Path to the /concrete/packages directory relative to the web root.

from  Package
protected string $REL_DIR_PACKAGES

Path to the /concrete/packages directory relative to the web root.

from  Package
protected Package|null $entity

Associated package entity.

from  Package
protected Application $app

The Application instance.

from  Package
protected Liaison|null $config

The database configuration liaison.

from  Package
protected Liaison|null $fileConfig

The file configuration liaison.

from  Package
protected bool deprecated $pkgEnableLegacyNamespace from  Package
protected array $pkgAutoloaderRegistries

The custom autoloader prefixes to be automatically added to the class loader.

from  Package
protected string $appVersionRequired

The minimum concrete5 version compatible with the package.

from  Package
protected bool $pkgAllowsFullContentSwap

Override this value and set it to true if your package clears all existing website content when it's being installed.

from  Package
protected bool $pkgContentProvidesFileThumbnails

Override this value and set it to true if your package provides the file thumbnails.

from  Package
protected string|null $backedUpFname

The full path of the package directory moved to the trash folder.

from  Package
protected array $packageDependencies

An array describing the package dependencies.

from  Package

Methods

__construct($pkgHandle, Application $application)

Initialize the instance.

Package|null
getPackageEntity()

Get the associated package entity (if available).

from  Package
setPackageEntity(Package $entity)

Set the associated package entity.

from  Package
getApplication()

Get the Application instance.

from  Package
getContentSwapper()

Get the content swapper.

from  Package
installContentFile(string $file)

Import a concrete5-cif XML file.

from  Package
bool
shouldEnableLegacyNamespace()

Should this package enable legacy namespaces?

from  Package
getConfig()

Get the default configuration liaison.

from  Package
getDatabaseConfig()

Get the database configuration liaison.

from  Package
getFileConfig()

Get the filesystem configuration liaison.

from  Package
array
getPackageAutoloaderRegistries()

Get the custom autoloader prefixes to be automatically added to the class loader.

from  Package
string
getPackageHandle()

Get the package handle.

from  Package
string
getPackageName()

Get the translated name of the package.

from  Package
string
getPackageDescription()

Get the translated package description.

from  Package
string
getPackageVersion()

Get the installed package version.

from  Package
string
getApplicationVersionRequired()

Get the minimum concrete5 version compatible with the package.

from  Package
bool
showInstallOptionsScreen()

Should the install options page be shown? The install options page may be for install notes and/or full contents swap confirmation.

from  Package
bool
hasInstallNotes()

Does this package have install notes?

from  Package
bool
hasUninstallNotes()

Does this package have uninstall notes?

from  Package
bool
hasInstallPostScreen()

Does this package have a post-install page?

from  Package
bool
allowsFullContentSwap()

Does this package clear all existing website content when it's being installed?

from  Package
string
getPackagePath()

Get the absolute path to the package.

from  Package
string
getRelativePath()

Get the path to the package relative to the web root.

from  Package
string
getRelativePathFromInstallFolder()

Get the path to the package relative to the concrete5 installation folder.

from  Package
getTranslationFile($locale)

No description

from  Package
bool
contentProvidesFileThumbnails()

Does this package provide the file thumbnails? If false, the file thumbnails are generated during the install process.

from  Package
install()

Install the package info row and the database (doctrine entities and db.xml).

uninstall()

Uninstall the package:

  • delete the installed items associated to the package
  • destroy the package proxy classes of entities
  • remove the package info row.

from  Package
string
getChangelogContents()

Get the contents of the package's CHANGELOG file.

from  Package
static Package[]
getInstalledList() deprecated

No description

from  Package
static string[]
getInstalledHandles() deprecated

No description

from  Package
static Package|null
getByHandle(string $pkgHandle) deprecated

No description

from  Package
static Package[]
getLocalUpgradeablePackages() deprecated

No description

from  Package
static Package[]
getRemotelyUpgradeablePackages() deprecated

No description

from  Package
static Package[]
getAvailablePackages(bool $filterInstalled = true) deprecated

No description

from  Package
static Package|null
getByID(int $pkgID) deprecated

No description

from  Package
static Package
getClass(string $pkgHandle) deprecated

No description

from  Package
ErrorList|true
testForInstall(bool $testForAlreadyInstalled = true)

Perform tests before this package is installed.

from  Package
ErrorList|true
testForUpgrade()

Perform tests before this package is upgraded.

from  Package
ErrorList|true
testForUninstall()

Perform tests before this package is uninstalled.

from  Package
backup()

Move the current package directory to the trash directory, and rename it with the package handle and a date code.

from  Package
bool
restore()

If a package was just backed up by this instance of the package object and the packages/package handle directory doesn't exist, this will restore the package from the trash.

from  Package
getPackageEntityPaths() deprecated

No description

from  Package
installDatabase()

Installs the packages database through doctrine entities and db.xml database definitions.

from  Package
installEntitiesDatabase()

No description

from  Package
static bool|stdClass
installDB(string $xmlFile)

Installs a package database from an XML file.

from  Package
upgradeCoreData()

Updates the package entity name, description and version using the current class properties.

from  Package
upgrade()

Upgrades a package's database and refreshes all blocks.

from  Package
upgradeDatabase()

Updates a package's database using entities and a db.xml.

from  Package
string
getNamespace(bool $withLeadingBackslash = false)

Get the namespace of the package by the package handle.

from  Package
EntityManager|null
getPackageEntityManager()

Create an entity manager used for the package install, upgrade and unistall process.

from  Package
EntityManagerInterface
getEntityManager() deprecated

No description

from  Package
int|null
getPackageID() deprecated

No description

from  Package
getTranslatableStrings(Translations $translations)

Override this method in your package controller to add strings to the translator, so that you can translate dynamically generated strings.

from  Package
array
getPackageDependencies()

Return the package dependencies.

from  Package
string
getErrorText(array|int $errorCode)

Get the error text corresponsing to an error code.

from  Package
destroyProxyClasses(EntityManagerInterface $em)

Destroys all proxies related to a package.

from  Package
getInstallErrorMessage()

No description

Details

__construct($pkgHandle, Application $application)

Initialize the instance.

Parameters

$pkgHandle
Application $application

Package|null getPackageEntity()

Get the associated package entity (if available).

Return Value

Package|null

May return NULL if the package is invalid and/or if it's not installed

setPackageEntity(Package $entity)

Set the associated package entity.

Parameters

Package $entity

Application getApplication()

Get the Application instance.

Return Value

Application

ContentSwapperInterface getContentSwapper()

Get the content swapper.

installContentFile(string $file)

Import a concrete5-cif XML file.

Parameters

string $file

the path to the file, relative to the package directory

bool shouldEnableLegacyNamespace()

Should this package enable legacy namespaces?

This returns true IF:

  1. $this->pkgAutoloaderMapCoreExtensions is false or unset
  2. The required package version > 7.9.9 meaning version 8 or newer
  3. $this->pkgEnableLegacyNamespace is true

Return Value

bool

Liaison getConfig()

Get the default configuration liaison.

Return Value

Liaison

Liaison getDatabaseConfig()

Get the database configuration liaison.

Return Value

Liaison

Liaison getFileConfig()

Get the filesystem configuration liaison.

Return Value

Liaison

array getPackageAutoloaderRegistries()

Get the custom autoloader prefixes to be automatically added to the class loader.

Array keys are the locations (relative to the package directory). Array values are the paths (not relative to the package namespace).

Return Value

array

Examples

['src/PortlandLabs' => \PortlandLabs']

string getPackageHandle()

Get the package handle.

Return Value

string

string getPackageName()

Get the translated name of the package.

Return Value

string

string getPackageDescription()

Get the translated package description.

Return Value

string

string getPackageVersion()

Get the installed package version.

Return Value

string

string getApplicationVersionRequired()

Get the minimum concrete5 version compatible with the package.

Return Value

string

bool showInstallOptionsScreen()

Should the install options page be shown? The install options page may be for install notes and/or full contents swap confirmation.

Return Value

bool

bool hasInstallNotes()

Does this package have install notes?

Return Value

bool

bool hasUninstallNotes()

Does this package have uninstall notes?

Return Value

bool

bool hasInstallPostScreen()

Does this package have a post-install page?

Return Value

bool

bool allowsFullContentSwap()

Does this package clear all existing website content when it's being installed?

Return Value

bool

string getPackagePath()

Get the absolute path to the package.

Return Value

string

string getRelativePath()

Get the path to the package relative to the web root.

Return Value

string

string getRelativePathFromInstallFolder()

Get the path to the package relative to the concrete5 installation folder.

Return Value

string

getTranslationFile($locale)

No description

bool contentProvidesFileThumbnails()

Does this package provide the file thumbnails? If false, the file thumbnails are generated during the install process.

Return Value

bool

Package install()

Install the package info row and the database (doctrine entities and db.xml).

Packages installing additional content should override this method, call the parent method (parent::install()).

Return Value

Package

uninstall()

Uninstall the package:

  • delete the installed items associated to the package
  • destroy the package proxy classes of entities
  • remove the package info row.

string getChangelogContents()

Get the contents of the package's CHANGELOG file.

Return Value

string

if no changelog is available an empty string is returned

static Package[] getInstalledList() deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getInstalledList()

No description

Return Value

Package[]

static string[] getInstalledHandles() deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getInstalledHandles()

No description

Return Value

string[]

static Package|null getByHandle(string $pkgHandle) deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getInstalledHandles()

No description

Parameters

string $pkgHandle

Return Value

Package|null

static Package[] getLocalUpgradeablePackages() deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getLocalUpgradeablePackages()

No description

Return Value

Package[]

static Package[] getRemotelyUpgradeablePackages() deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getRemotelyUpgradeablePackages()

No description

Return Value

Package[]

static Package[] getAvailablePackages(bool $filterInstalled = true) deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getAvailablePackages($filterInstalled)

No description

Parameters

bool $filterInstalled

Return Value

Package[]

static Package|null getByID(int $pkgID) deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getByID($pkgID)

No description

Parameters

int $pkgID

Return Value

Package|null

static Package getClass(string $pkgHandle) deprecated

deprecated Use $app->make('Concrete\Core\Package\PackageService')->getClass($pkgHandle)

No description

Parameters

string $pkgHandle

Return Value

Package

ErrorList|true testForInstall(bool $testForAlreadyInstalled = true)

Perform tests before this package is installed.

Parameters

bool $testForAlreadyInstalled

Set to false to skip checking if this package is already installed

Return Value

ErrorList|true

return true if the package can be installed, an ErrorList instance otherwise

ErrorList|true testForUpgrade()

Perform tests before this package is upgraded.

Return Value

ErrorList|true

return null if the package can be upgraded, an ErrorList instance otherwise

ErrorList|true testForUninstall()

Perform tests before this package is uninstalled.

Return Value

ErrorList|true

return true if the package can be uninstalled, an ErrorList instance otherwise

ErrorList|Package backup()

Move the current package directory to the trash directory, and rename it with the package handle and a date code.

Return Value

ErrorList|Package

return the Package instance if the package has been moved, an ErrorList instance otherwise

bool restore()

If a package was just backed up by this instance of the package object and the packages/package handle directory doesn't exist, this will restore the package from the trash.

Return Value

bool

getPackageEntityPaths() deprecated

deprecated This method was limited. It let you specify a location but in V8 with the Doctrine Entity Manager driver chain we also need to specify namespaces. Instead of specifying entity paths this way, update your package controller to implement the Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface, and create a method named getEntityManagerProvider that returns an instance of the Concrete\Core\Database\EntityManager\Provider\ProviderInterface. For example, if I want to specify that my package has entities found at src/PortlandLabs\FooBar\Entity, with the namespace PortlandLabs\FooBar\Entity, my method is simply public function getEntityManagerProvider() { return new StandardPackageProvider($this->app, $this, ['src/MSM/Entity' => 'PortlandLabs\MSM\Entity']); }

No description

installDatabase()

Installs the packages database through doctrine entities and db.xml database definitions.

installEntitiesDatabase()

No description

static bool|stdClass installDB(string $xmlFile)

Installs a package database from an XML file.

Parameters

string $xmlFile

Path to the database XML file

Return Value

bool|stdClass

Returns false if the XML file could not be found

Exceptions

ConnectionException

upgradeCoreData()

Updates the package entity name, description and version using the current class properties.

upgrade()

Upgrades a package's database and refreshes all blocks.

upgradeDatabase()

Updates a package's database using entities and a db.xml.

Exceptions

ConnectionException
Exception

string getNamespace(bool $withLeadingBackslash = false)

Get the namespace of the package by the package handle.

Parameters

bool $withLeadingBackslash

Return Value

string

EntityManager|null getPackageEntityManager()

Create an entity manager used for the package install, upgrade and unistall process.

Return Value

EntityManager|null

EntityManagerInterface getEntityManager() deprecated

deprecated Use $app->make('Doctrine\ORM\EntityManagerInterface')

No description

Return Value

EntityManagerInterface

int|null getPackageID() deprecated

deprecated use the getPackageID method of the package entity

No description

Return Value

int|null

getTranslatableStrings(Translations $translations)

Override this method in your package controller to add strings to the translator, so that you can translate dynamically generated strings.

Parameters

Translations $translations

Examples

If you add to this method these two strings:

<code>
$translations->insert('', 'String without context');
$translations->insert('MyContext', 'String with context');
</code>

Then you'll be able to translate these two strings in the Translator and write translated strings with:

<code>
echo t('String without context');
echo tc('MyContext', 'String with context');
</code>

array getPackageDependencies()

Return the package dependencies.

Return Value

array

See also

Package::$packageDependencies

protected string getErrorText(array|int $errorCode)

Get the error text corresponsing to an error code.

Parameters

array|int $errorCode

one of the Package::EPACKAGE constants, or an array with the first value is one of the Package::EPACKAGE constants and the other values are used to fill in fields

Return Value

string

protected destroyProxyClasses(EntityManagerInterface $em)

Destroys all proxies related to a package.

Parameters

EntityManagerInterface $em

getInstallErrorMessage()

No description