Package
abstract class Package implements LocalizablePackageInterface (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. |
|
protected string | $DIR_PACKAGES | Absolute path to the /packages directory. |
|
protected string | $REL_DIR_PACKAGES_CORE | Path to the /concrete/packages directory relative to the web root. |
|
protected string | $REL_DIR_PACKAGES | Path to the /concrete/packages directory relative to the web root. |
|
protected Package|null | $entity | Associated package entity. |
|
protected Application | $app | The Application instance. |
|
protected Liaison|null | $config | The database configuration liaison. |
|
protected Liaison|null | $fileConfig | The file configuration liaison. |
|
protected bool deprecated | $pkgEnableLegacyNamespace | ||
protected array | $pkgAutoloaderRegistries | The custom autoloader prefixes to be automatically added to the class loader. |
|
protected string | $appVersionRequired | The minimum concrete5 version compatible with the 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. |
|
protected bool | $pkgContentProvidesFileThumbnails | Override this value and set it to true if your package provides the file thumbnails. |
|
protected string|null | $backedUpFname | The full path of the package directory moved to the trash folder. |
|
protected array | $packageDependencies | An array describing the package dependencies. |
Methods
Get the associated package entity (if available).
Get the Application instance.
Get the content swapper.
Import a concrete5-cif XML file.
Should this package enable legacy namespaces?
Get the database configuration liaison.
Get the filesystem configuration liaison.
Get the custom autoloader prefixes to be automatically added to the class loader.
Get the package handle.
Get the translated name of the package.
Get the translated package description.
Get the installed package version.
Get the minimum concrete5 version compatible with the package.
Should the install options page be shown? The install options page may be for install notes and/or full contents swap confirmation.
Does this package have install notes?
Does this package have uninstall notes?
Does this package have a post-install page?
Does this package clear all existing website content when it's being installed?
Get the absolute path to the package.
Get the path to the package relative to the web root.
Get the path to the package relative to the concrete5 installation folder.
No description
Does this package provide the file thumbnails? If false, the file thumbnails are generated during the install process.
Uninstall the package:
- delete the installed items associated to the package
- destroy the package proxy classes of entities
- remove the package info row.
Get the contents of the package's CHANGELOG file.
Perform tests before this package is installed.
Perform tests before this package is upgraded.
Perform tests before this package is uninstalled.
Move the current package directory to the trash directory, and rename it with the package handle and a date code.
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.
Installs the packages database through doctrine entities and db.xml database definitions.
No description
Updates the package entity name, description and version using the current class properties.
Upgrades a package's database and refreshes all blocks.
Updates a package's database using entities and a db.xml.
Get the namespace of the package by the package handle.
Create an entity manager used for the package install, upgrade and unistall process.
Override this method in your package controller to add strings to the translator, so that you can translate dynamically generated strings.
Return the package dependencies.
Get the error text corresponsing to an error code.
Destroys all proxies related to a package.
Details
__construct(Application $app)
Initialize the instance.
Package|null
getPackageEntity()
Get the associated package entity (if available).
setPackageEntity(Package $entity)
Set the associated package entity.
Application
getApplication()
Get the Application instance.
ContentSwapperInterface
getContentSwapper()
Get the content swapper.
installContentFile(string $file)
Import a concrete5-cif XML file.
bool
shouldEnableLegacyNamespace()
Should this package enable legacy namespaces?
This returns true IF:
- $this->pkgAutoloaderMapCoreExtensions is false or unset
- The required package version > 7.9.9 meaning version 8 or newer
- $this->pkgEnableLegacyNamespace is true
Liaison
getConfig()
Get the default configuration liaison.
Liaison
getDatabaseConfig()
Get the database configuration liaison.
Liaison
getFileConfig()
Get the filesystem configuration 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).
string
getPackageHandle()
Get the package handle.
string
getPackageName()
Get the translated name of the package.
string
getPackageDescription()
Get the translated package description.
string
getPackageVersion()
Get the installed package version.
string
getApplicationVersionRequired()
Get the minimum concrete5 version compatible with the 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.
bool
hasInstallNotes()
Does this package have install notes?
bool
hasUninstallNotes()
Does this package have uninstall notes?
bool
hasInstallPostScreen()
Does this package have a post-install page?
bool
allowsFullContentSwap()
Does this package clear all existing website content when it's being installed?
string
getPackagePath()
Get the absolute path to the package.
string
getRelativePath()
Get the path to the package relative to the web root.
string
getRelativePathFromInstallFolder()
Get the path to the package relative to the concrete5 installation folder.
getTranslationFile($locale)
No description
bool
contentProvidesFileThumbnails()
Does this package provide the file thumbnails? If false, the file thumbnails are generated during the install process.
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()
).
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.
static Package[]
getInstalledList()
deprecated
deprecated
No description
static string[]
getInstalledHandles()
deprecated
deprecated
No description
static Package|null
getByHandle(string $pkgHandle)
deprecated
deprecated
No description
static Package[]
getLocalUpgradeablePackages()
deprecated
deprecated
No description
static Package[]
getRemotelyUpgradeablePackages()
deprecated
deprecated
No description
static Package[]
getAvailablePackages(bool $filterInstalled = true)
deprecated
deprecated
No description
static Package|null
getByID(int $pkgID)
deprecated
deprecated
No description
static Package
getClass(string $pkgHandle)
deprecated
deprecated
No description
ErrorList|true
testForInstall(bool $testForAlreadyInstalled = true)
Perform tests before this package is installed.
ErrorList|true
testForUpgrade()
Perform tests before this package is upgraded.
ErrorList|true
testForUninstall()
Perform tests before this package is uninstalled.
ErrorList|Package
backup()
Move the current package directory to the trash directory, and rename it with the package handle and a date code.
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.
getPackageEntityPaths()
deprecated
deprecated
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.
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.
string
getNamespace(bool $withLeadingBackslash = false)
Get the namespace of the package by the package handle.
EntityManager|null
getPackageEntityManager()
Create an entity manager used for the package install, upgrade and unistall process.
EntityManagerInterface
getEntityManager()
deprecated
deprecated
No description
int|null
getPackageID()
deprecated
deprecated
No description
getTranslatableStrings(Translations $translations)
Override this method in your package controller to add strings to the translator, so that you can translate dynamically generated strings.
array
getPackageDependencies()
Return the package dependencies.
protected string
getErrorText(array|int $errorCode)
Get the error text corresponsing to an error code.
protected
destroyProxyClasses(EntityManagerInterface $em)
Destroys all proxies related to a package.