PHP Класс FOF30\Utils\InstallScript

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cliScriptFiles array A list of scripts to be copied to the "cli" directory of the site
$cliSourcePath string The path inside your package where cli scripts are stored
$componentName string The component's name
$componentTitle string The title of the component (printed on installation and uninstallation messages)
$isPaid boolean Is this the paid version of the extension? This only determines which files / extensions will be removed.
$maximumJoomlaVersion string The maximum Joomla! version this extension can be installed on
$minimumJoomlaVersion string The minimum Joomla! version required to install this extension
$minimumPHPVersion string The minimum PHP version required to install this extension
$postInstallationMessages array This array contains the message definitions for the Post-installation Messages component added in Joomla! 3.2 and later versions. Each element is also a hashed array. For the keys used in these message definitions please
$removeFilesAllVersions array Obsolete files and folders to remove from both paid and free releases. This is used when you refactor code and some files inevitably become obsolete and need to be removed.
$removeFilesFree array Obsolete files and folders to remove from the free version only. This is used when you move a feature from the free version of your extension to its paid version. If you don't have such a distinction you can ignore this.
$schemaXmlPath string The path where the schema XML files are stored. Its contents depend on the schemaXmlPathRelative variable above true => schemaXmlPath contains a path relative to the component's back-end directory false => schemaXmlPath contains an absolute filesystem path
$schemaXmlPathRelative boolean Is the schemaXmlPath class variable a relative path? If set to true the schemaXmlPath variable contains a path relative to the component's back-end directory. If set to false the schemaXmlPath variable contains an absolute filesystem path.
$uninstallation_queue array The list of obsolete extra modules and plugins to uninstall on component upgrade / installation.

Открытые методы

Метод Описание
postflight ( string $type, JInstallerAdapterComponent $parent ) Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing or updating your component. This is the last chance you've got to perform any additional installations, clean-up, database updates and similar housekeeping functions.
preflight ( string $type, JInstallerAdapterComponent $parent ) : boolean Joomla! pre-flight event. This runs before Joomla! installs or updates the component. This is our last chance to tell Joomla! if it should abort the installation.
uninstall ( JInstallerAdapterComponent $parent ) Runs on uninstallation

Защищенные методы

Метод Описание
_applyPostInstallationMessages ( ) : void Applies the post-installation messages for Joomla! 3.2 or later
addDependency ( string $package, string $dependency ) Adds a package dependency to #__akeeba_common
addPostInstallationMessage ( array $options ) : void Adds or updates a post-installation message (PIM) definition for Joomla! 3.2 or later. You can use this in your post-installation script using this code:
bugfixCantBuildAdminMenus ( ) Joomla! 1.6+ bugfix for "Can not build admin menus"
bugfixDBFunctionReturnedNoError ( ) Bugfix for "DB function returned no error"
copyCliFiles ( JInstallerAdapterComponent $parent ) Copies the CLI scripts into Joomla!'s cli directory
getDependencies ( string $package ) : array Get the dependencies for a package from the #__akeeba_common table
hasDependency ( string $package, string $dependency ) : boolean Do I have a dependency for a package in #__akeeba_common
removeDependency ( string $package, string $dependency ) Removes a package dependency from #__akeeba_common
removeFilesAndFolders ( array $removeList ) Removes obsolete files and folders
renderPostInstallation ( JInstallerAdapterComponent $parent ) Override this method to display a custom component installation message if you so wish
renderPostUninstallation ( JInstallerAdapterComponent $parent ) Override this method to display a custom component uninstallation message if you so wish
setDependencies ( string $package, array $dependencies ) Sets the dependencies for a package into the #__akeeba_common table
uninstallObsoleteSubextensions ( JInstallerAdapterComponent $parent ) : stdClass Uninstalls obsolete subextensions (modules, plugins) bundled with the main extension
uninstallPostInstallationMessages ( )

Приватные методы

Метод Описание
_createAdminMenus ( JInstallerAdapterComponent $parent ) : boolean
_reallyPublishAdminMenuItems ( JInstallerAdapterComponent $parent ) : boolean Make sure the Component menu items are really published!
_rebuildMenu ( ) Tells Joomla! to rebuild its menu structure to make triple-sure that the Components menu items really do exist in the correct place and can really be rendered.

Описание методов

_applyPostInstallationMessages() защищенный Метод

Applies the post-installation messages for Joomla! 3.2 or later
protected _applyPostInstallationMessages ( ) : void
Результат void

addDependency() защищенный Метод

Adds a package dependency to #__akeeba_common
protected addDependency ( string $package, string $dependency )
$package string The package
$dependency string The dependency to add

addPostInstallationMessage() защищенный Метод

The $options array contains the following mandatory keys: extension_id The numeric ID of the extension this message is for (see the #__extensions table) type One of message, link or action. Their meaning is: message Informative message. The user can dismiss it. link The action button links to a URL. The URL is defined in the action parameter. action A PHP action takes place when the action button is clicked. You need to specify the action_file (RAD path to the PHP file) and action (PHP function name) keys. See below for more information. title_key The JText language key for the title of this PIM Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_TITLE description_key The JText language key for the main body (description) of this PIM Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_DESCRIPTION action_key The JText language key for the action button. Ignored and not required when type=message Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_ACTION language_extension The extension name which holds the language keys used above. For example, com_foobar, mod_something, plg_system_whatever, tpl_mytemplate language_client_id Should we load the front-end (0) or back-end (1) language keys? version_introduced Which was the version of your extension where this message appeared for the first time? Example: 3.2.1 enabled Must be 1 for this message to be enabled. If you omit it, it defaults to 1. condition_file The RAD path to a PHP file containing a PHP function which determines whether this message should be shown to the user. @see Template::parsePath() for RAD path format. Joomla! will include this file before calling the condition_method. Example: admin://components/com_foobar/helpers/postinstall.php condition_method The name of a PHP function which will be used to determine whether to show this message to the user. This must be a simple PHP user function (not a class method, static method etc) which returns true to show the message and false to hide it. This function is defined in the condition_file. Example: com_foobar_postinstall_messageone_condition When type=message no additional keys are required. When type=link the following additional keys are required: action The URL which will open when the user clicks on the PIM's action button Example: index.php?option=com_foobar&view=tools&task=installSampleData Then type=action the following additional keys are required: action_file The RAD path to a PHP file containing a PHP function which performs the action of this PIM.
См. также: Template::parsePath() for RAD path format. Joomla! will include this file before calling the function defined in the action key below. Example: admin://components/com_foobar/helpers/postinstall.php action The name of a PHP function which will be used to run the action of this PIM. This must be a simple PHP user function (not a class method, static method etc) which returns no result. Example: com_foobar_postinstall_messageone_action
protected addPostInstallationMessage ( array $options ) : void
$options array See description
Результат void

bugfixCantBuildAdminMenus() защищенный Метод

Joomla! 1.6+ bugfix for "Can not build admin menus"

bugfixDBFunctionReturnedNoError() защищенный Метод

Bugfix for "DB function returned no error"

copyCliFiles() защищенный Метод

Copies the CLI scripts into Joomla!'s cli directory
protected copyCliFiles ( JInstallerAdapterComponent $parent )
$parent JInstallerAdapterComponent

getDependencies() защищенный Метод

Get the dependencies for a package from the #__akeeba_common table
protected getDependencies ( string $package ) : array
$package string The package
Результат array The dependencies

hasDependency() защищенный Метод

Do I have a dependency for a package in #__akeeba_common
protected hasDependency ( string $package, string $dependency ) : boolean
$package string The package
$dependency string The dependency to check for
Результат boolean

postflight() публичный Метод

Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing or updating your component. This is the last chance you've got to perform any additional installations, clean-up, database updates and similar housekeeping functions.
public postflight ( string $type, JInstallerAdapterComponent $parent )
$type string install, update or discover_update
$parent JInstallerAdapterComponent Parent object

preflight() публичный Метод

Joomla! pre-flight event. This runs before Joomla! installs or updates the component. This is our last chance to tell Joomla! if it should abort the installation.
public preflight ( string $type, JInstallerAdapterComponent $parent ) : boolean
$type string Installation type (install, update, discover_install)
$parent JInstallerAdapterComponent Parent object
Результат boolean True to let the installation proceed, false to halt the installation

removeDependency() защищенный Метод

Removes a package dependency from #__akeeba_common
protected removeDependency ( string $package, string $dependency )
$package string The package
$dependency string The dependency to remove

removeFilesAndFolders() защищенный Метод

Removes obsolete files and folders
protected removeFilesAndFolders ( array $removeList )
$removeList array The files and directories to remove

renderPostInstallation() защищенный Метод

Override this method to display a custom component installation message if you so wish
protected renderPostInstallation ( JInstallerAdapterComponent $parent )
$parent JInstallerAdapterComponent Parent class calling us

renderPostUninstallation() защищенный Метод

Override this method to display a custom component uninstallation message if you so wish
protected renderPostUninstallation ( JInstallerAdapterComponent $parent )
$parent JInstallerAdapterComponent Parent class calling us

setDependencies() защищенный Метод

Sets the dependencies for a package into the #__akeeba_common table
protected setDependencies ( string $package, array $dependencies )
$package string The package
$dependencies array The dependencies list

uninstall() публичный Метод

Runs on uninstallation
public uninstall ( JInstallerAdapterComponent $parent )
$parent JInstallerAdapterComponent The parent object

uninstallObsoleteSubextensions() защищенный Метод

Uninstalls obsolete subextensions (modules, plugins) bundled with the main extension
protected uninstallObsoleteSubextensions ( JInstallerAdapterComponent $parent ) : stdClass
$parent JInstallerAdapterComponent The parent object
Результат stdClass The subextension uninstallation status

uninstallPostInstallationMessages() защищенный Метод

Описание свойств

$cliScriptFiles защищенное свойство

A list of scripts to be copied to the "cli" directory of the site
protected array $cliScriptFiles
Результат array

$cliSourcePath защищенное свойство

The path inside your package where cli scripts are stored
protected string $cliSourcePath
Результат string

$componentName защищенное свойство

The component's name
protected string $componentName
Результат string

$componentTitle защищенное свойство

The title of the component (printed on installation and uninstallation messages)
protected string $componentTitle
Результат string

$isPaid защищенное свойство

Is this the paid version of the extension? This only determines which files / extensions will be removed.
protected bool $isPaid
Результат boolean

$maximumJoomlaVersion защищенное свойство

The maximum Joomla! version this extension can be installed on
protected string $maximumJoomlaVersion
Результат string

$minimumJoomlaVersion защищенное свойство

The minimum Joomla! version required to install this extension
protected string $minimumJoomlaVersion
Результат string

$minimumPHPVersion защищенное свойство

The minimum PHP version required to install this extension
protected string $minimumPHPVersion
Результат string

$postInstallationMessages защищенное свойство

This array contains the message definitions for the Post-installation Messages component added in Joomla! 3.2 and later versions. Each element is also a hashed array. For the keys used in these message definitions please
См. также: InstallScript::addPostInstallationMessage
protected array $postInstallationMessages
Результат array

$removeFilesAllVersions защищенное свойство

Obsolete files and folders to remove from both paid and free releases. This is used when you refactor code and some files inevitably become obsolete and need to be removed.
protected array $removeFilesAllVersions
Результат array

$removeFilesFree защищенное свойство

Obsolete files and folders to remove from the free version only. This is used when you move a feature from the free version of your extension to its paid version. If you don't have such a distinction you can ignore this.
protected array $removeFilesFree
Результат array

$schemaXmlPath защищенное свойство

The path where the schema XML files are stored. Its contents depend on the schemaXmlPathRelative variable above true => schemaXmlPath contains a path relative to the component's back-end directory false => schemaXmlPath contains an absolute filesystem path
protected string $schemaXmlPath
Результат string

$schemaXmlPathRelative защищенное свойство

Is the schemaXmlPath class variable a relative path? If set to true the schemaXmlPath variable contains a path relative to the component's back-end directory. If set to false the schemaXmlPath variable contains an absolute filesystem path.
protected bool $schemaXmlPathRelative
Результат boolean

$uninstallation_queue защищенное свойство

The list of obsolete extra modules and plugins to uninstall on component upgrade / installation.
protected array $uninstallation_queue
Результат array