Class Package

A package can contains related components that customize concrete5. They can br easily installed and uninstall by a user.

Concrete\Core\Foundation\Object
Extended by Concrete\Core\Package\Package

Direct known subclasses

Concrete\Core\Package\BrokenPackage

Methods summary

public static string
# getPackageItemsCategoryDisplayName( string $categoryHandle, string $format = 'html' )

Returns the display name of a category of package items (localized and escaped accordingly to $format)

public static string
# getItemName( mixed $item )

Returns the name of an object belonging to a package.

public static array|boolean
# testForInstall( string $package, boolean $testForAlreadyInstalled = true )

This is the pre-test routine that packages run through before they are installed. Any errors that come here are to be returned in the form of an array so we can show the user. If it's all good we return true.

public static Concrete\Core\Package\Package
# getClass( string $pkgHandle )

Returns a package's class.

public string
# getApplicationVersionRequired( )

Returns the version of concrete5 required by the package.

public static Concrete\Core\Package\Package
# getByHandle( string $pkgHandle )

Returns a Package object for the given package handle, null if not found.

public static Concrete\Core\Package\Package[]
# getLocalUpgradeablePackages( )

Returns an array of packages that have newer versions in the local packages directory than those which are in the Packages table. This means they're ready to be upgraded.

public static Concrete\Core\Package\Package[]
# getAvailablePackages( boolean $filterInstalled = true )

Returns all available packages.

public static string[]
# getInstalledHandles( )

Returns all installed package handles.

public static Concrete\Core\Package\Package[]
# getRemotelyUpgradeablePackages( )

Finds all packages that have an upgraded version available in the marketplace.

public static Concrete\Core\Package\Package[]
# getInstalledList( )

Returns an array of all installed packages.

public string
# getRelativePath( )

Returns the path to the package's folder, relative to the install path.

public string
# getPackageHandle( )

Returns the package handle.

public string
# getPackageDateInstalled( )

Gets the date the package was added to the system.

public
public boolean
# isPackageInstalled( )

Returns true if the package is installed, false if not.

public string
# getChangelogContents( )

Gets the contents of the package's CHANGELOG file. If no changelog is available an empty string is returned.

public
public string
# getPackageCurrentlyInstalledVersion( )

Returns the currently installed package version. NOTE: This function only returns a value if getLocalUpgradeablePackages() has been called first!

public boolean
public array
# getPackageAutoloaderRegistries( )

Returns custom autoloader prefixes registered by the class loader.

public boolean
# hasInstallPostScreen( )

Returns true if the package has a post install screen.

public boolean
# showInstallOptionsScreen( )

Returns true if the package has an install options screen.

public
public
public
public
# setupPackageLocalization( string $locale = null, Zend\I18n\Translator\Translator|string $translate = 'current' )

Loads package translation files into zend translate.

public boolean|int[]
# testForUninstall( )
public
# uninstall( )

Uninstalls the package. Removes any blocks, themes, or pages associated with the package.

public array
# getPackageItems( )

Returns an array of package items (e.g. blocks, themes).

protected boolean
# destroyProxyClasses( )

Destroys all the existing proxy classes for this package.

public Concrete\Core\Database\DatabaseStructureManager
# getDatabaseStructureManager( )

Gets a package specific entity manager.

public Concrete\Core\Database\EntityManagerFactoryInterface
public Doctrine\ORM\EntityManager
# getEntityManager( )

Gets a package specific entity manager.

public
# swapContent( $options )

Removes any existing pages, files, stacks, block and page types and installs content from the package.

protected boolean
# validateClearSiteContents( array $options )
public string
# contentProvidesFileThumbnails( )

Returns a path to where the packages files are located.

public static array
# mapError( $testResults )

Converts package install test errors to human-readable strings.

public string
# getPackageEntitiesPath( )

Returns the directory containing package entities.

public
# registerConfigNamespace( )

Called to enable package specific configuration.

public Concrete\Core\Config\Repository\Liaison
# getConfig( )

Get the standard database config liaison.

public Concrete\Core\Config\Repository\Liaison
# getDatabaseConfig( )

Get the standard database config liaison.

public Concrete\Core\Config\Repository\Liaison
# getFileConfig( )

Get the standard filesystem config liaison.

public Concrete\Core\Package\Package
# install( )

Installs the package info row and installs the database. Packages installing additional content should override this method, call the parent method, and use the resulting package object for further installs.

public string
# getPackageName( )

Returns the translated name of the package.

public string
# getPackageDescription( )

Returns the translated package description.

public string
# getPackageVersion( )

Returns the installed package version.

public static Concrete\Core\Package\Package
# getByID( integer $pkgID )

Returns a Package object for the given package id, null if not found.

public
# installDatabase( )

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

public
public static boolean|stdClass
# installDB( string $xmlFile )

Installs a package's database from an XML file.

public
# updateAvailableVersionNumber( string $vNum )

Updates the available package number in the database.

public integer|null
# getPackageID( )

Returns the package ID.

public
# setPackageID( integer|null $value )

Sets the package ID.

public
# upgradeCoreData( )

Updates a package's name, description, version and ID using the current class properties.

public
# upgrade( )

Upgrades a package's database and refreshes all blocks.

public
# upgradeDatabase( )

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

public
# backup( )

Moves the current package's directory to the trash directory renamed with the package handle and a date code.

public
# 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.

Constants summary

integer E_PACKAGE_NOT_FOUND
# 1
integer E_PACKAGE_INSTALLED
# 2
integer E_PACKAGE_VERSION
# 3
integer E_PACKAGE_DOWNLOAD
# 4
integer E_PACKAGE_SAVE
# 5
integer E_PACKAGE_UNZIP
# 6
integer E_PACKAGE_INSTALL
# 7
integer E_PACKAGE_MIGRATE_BACKUP
# 8
integer E_PACKAGE_INVALID_APP_VERSION
# 20
integer E_PACKAGE_THEME_ACTIVE
# 21

Properties inherited from Concrete\Core\Foundation\Object

$error

Magic properties

public string $pkgName

Installed name of package

public string $pkgHandle

Installed handle of package. This should be provided by the ending package.

public string $pkgDescription

Installed description of package

public boolean $pkgIsInstalled

True if package is installed

public string $pkgVersion

Version of package installed

public string $pkgAvailableVersion