Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 et du framework Joomla Platform intégré
Référence de la classe FOFUtilsInstallscript

Fonctions membres publiques

 preflight ($type, $parent)
 
 postflight ($type, $parent)
 
 uninstall ($parent)
 

Fonctions membres protégées

 copyCliFiles ($parent)
 
 renderPostInstallation ($status, $fofInstallationStatus, $strapperInstallationStatus, $parent)
 
 renderPostUninstallation ($status, $parent)
 
 bugfixDBFunctionReturnedNoError ()
 
 bugfixCantBuildAdminMenus ()
 
 installSubextensions ($parent)
 
 uninstallSubextensions ($parent)
 
 removeFilesAndFolders ($removeList)
 
 installFOF ($parent)
 
 installStrapper ($parent)
 
 uninstallObsoleteSubextensions ($parent)
 
 addPostInstallationMessage (array $options)
 
 _applyPostInstallationMessages ()
 
 uninstallPostInstallationMessages ()
 

Attributs protégés

 $componentName = 'com_foobar'
 
 $componentTitle = 'Foobar Component'
 
 $installation_queue
 
 $uninstallation_queue
 
 $removeFilesFree
 
 $removeFilesAllVersions
 
 $cliScriptFiles
 
 $cliSourcePath = 'cli'
 
 $fofSourcePath = 'fof'
 
 $strapperSourcePath = 'strapper'
 
 $modulesSourcePath = 'modules'
 
 $pluginsSourcePath = 'plugins'
 
 $schemaXmlPathRelative = true
 
 $schemaXmlPath = 'sql/xml'
 
 $minimumPHPVersion = '5.3.3'
 
 $minimumJoomlaVersion = '2.5.6'
 
 $maximumJoomlaVersion = '3.9.99'
 
 $isPaid = false
 
 $postInstallationMessages = array()
 

Fonctions membres privées

 _reallyPublishAdminMenuItems ($parent)
 

Description détaillée

A helper class which you can use to create component installation scripts

Documentation des fonctions membres

◆ _applyPostInstallationMessages()

_applyPostInstallationMessages ( )
protected

Applies the post-installation messages for Joomla! 3.2 or later

Renvoie
void

Références $db, $message, $query, et FOFPlatform\getInstance().

◆ _reallyPublishAdminMenuItems()

_reallyPublishAdminMenuItems (   $parent)
private

Make sure the Component menu items are really published!

Paramètres
JInstallerAdapterComponent$parent
Renvoie
bool

Références $db, $option, $query, et FOFPlatform\getInstance().

◆ addPostInstallationMessage()

addPostInstallationMessage ( array  $options)
protected

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:

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.

Voir également
FOFTemplateUtils::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.

Voir également
FOFTemplateUtils::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

Paramètres
array$optionsSee description
Renvoie
void
Exceptions
Exception

Références $db, $key, $options, $query, FOFPlatform\getInstance(), et FOFTemplateUtils\parsePath().

◆ bugfixCantBuildAdminMenus()

bugfixCantBuildAdminMenus ( )
protected

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

            $query = $db->getQuery(true);
            $query->select('id')
                    ->from('#__menu')
                    ->where($db->qn('type') . ' = ' . $db->q('component'))
                    ->where($db->qn('menutype') . ' = ' . $db->q('main'))
                    ->where($db->qn('link') . ' LIKE ' . $db->q('index.php?option=' . $this->componentName));
            $db->setQuery($query);

            try
            {
                    $ids1 = $db->loadColumn();
            }
            catch (Exception $exc)
            {
                    $ids1 = array();
            }

            if (empty($ids1))
            {
                    $ids1 = array();
            }

            $query = $db->getQuery(true);
            $query->select('id')
                    ->from('#__menu')
                    ->where($db->qn('type') . ' = ' . $db->q('component'))
                    ->where($db->qn('menutype') . ' = ' . $db->q('main'))
                    ->where($db->qn('link') . ' LIKE ' . $db->q('index.php?option=' . $this->componentName . '&%'));
            $db->setQuery($query);

            try
            {
                    $ids2 = $db->loadColumn();
            }
            catch (Exception $exc)
            {
                    $ids2 = array();
            }

            if (empty($ids2))
            {
                    $ids2 = array();
            }

            $ids = array_merge($ids1, $ids2);

            if (!empty($ids))
            {
                    foreach ($ids as $id)
                    {
                            $query = $db->getQuery(true);
                            $query->delete('#__menu')
                                    ->where($db->qn('id') . ' = ' . $db->q($id));
                            $db->setQuery($query);

                            try
                            {
                                    $db->execute();
                            }
                            catch (Exception $exc)
                            {

Nothing } } } /*

Références $db, $id, $query, et FOFPlatform\getInstance().

◆ bugfixDBFunctionReturnedNoError()

bugfixDBFunctionReturnedNoError ( )
protected

Bugfix for "DB function returned no error"

Références $db, $id, $query, et FOFPlatform\getInstance().

◆ copyCliFiles()

copyCliFiles (   $parent)
protected

Copies the CLI scripts into Joomla!'s cli directory

Paramètres
JInstaller$parent

Références $script, JFile\copy(), JFolder\create(), JFile\delete(), JFolder\exists(), JFile\exists(), et JPATH_ROOT.

◆ installFOF()

installFOF (   $parent)
protected

Installs FOF if necessary

Paramètres
JInstaller$parentThe parent object
Renvoie
array The installation status

Références $info, $target, JFolder\exists(), JFile\exists(), JPATH_LIBRARIES, JPATH_ROOT, et JFile\read().

◆ installStrapper()

installStrapper (   $parent)
protected

Installs Akeeba Strapper if necessary

Paramètres
JInstaller$parentThe parent object
Renvoie
array The installation status

Références $info, $target, JFolder\exists(), JFile\exists(), JPATH_ROOT, et JFile\read().

◆ installSubextensions()

installSubextensions (   $parent)
protected

Installs subextensions (modules, plugins) bundled with the main extension

Paramètres
JInstaller$parent
Renvoie
JObject The subextension installation status

Références $count, $db, $folder, $module, $modules, $path, $position, $published, $query, FOFUtilsCacheCleaner\clearPluginsAndModulesCache(), et FOFPlatform\getInstance().

◆ postflight()

postflight (   $type,
  $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.

Paramètres
string$typeinstall, update or discover_update
JInstaller$parentParent object

Références elseif, FOFPlatform\getInstance(), et JPATH_ADMINISTRATOR.

◆ preflight()

preflight (   $type,
  $parent 
)

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.

Paramètres
string$typeInstallation type (install, update, discover_install)
JInstaller$parentParent object
Renvoie
boolean True to let the installation proceed, false to halt the installation

Références $type, $version, elseif, et JError\raiseWarning().

◆ removeFilesAndFolders()

removeFilesAndFolders (   $removeList)
protected

Removes obsolete files and folders

Paramètres
array$removeListThe files and directories to remove

Références $file, $folder, JFile\delete(), JFolder\delete(), JFolder\exists(), JFile\exists(), et JPATH_ROOT.

◆ renderPostInstallation()

renderPostInstallation (   $status,
  $fofInstallationStatus,
  $strapperInstallationStatus,
  $parent 
)
protected

Renders the message after installing or upgrading the component

Références $module, $rows, endforeach, endif, thead, et width.

◆ renderPostUninstallation()

renderPostUninstallation (   $status,
  $parent 
)
protected

Renders the message after uninstalling the component

Références $module, $rows, endforeach, endif, thead, et width.

◆ uninstall()

uninstall (   $parent)

Runs on uninstallation

Paramètres
JInstaller$parentThe parent object

Références JPATH_ADMINISTRATOR.

◆ uninstallObsoleteSubextensions()

uninstallObsoleteSubextensions (   $parent)
protected

Uninstalls obsolete subextensions (modules, plugins) bundled with the main extension

Paramètres
JInstaller$parentThe parent object
Renvoie
stdClass The subextension uninstallation status

Références $db, $folder, $id, $module, $modules, FOFPlatform\getInstance(), et JLoader\import().

◆ uninstallPostInstallationMessages()

uninstallPostInstallationMessages ( )
protected

Références $db, $query, et FOFPlatform\getInstance().

◆ uninstallSubextensions()

uninstallSubextensions (   $parent)
protected

Uninstalls subextensions (modules, plugins) bundled with the main extension

Paramètres
JInstaller$parentThe parent object
Renvoie
stdClass The subextension uninstallation status

Références $db, $folder, $id, $module, $modules, $published, FOFUtilsCacheCleaner\clearPluginsAndModulesCache(), et FOFPlatform\getInstance().

Documentation des champs

◆ $cliScriptFiles

$cliScriptFiles
protected
Valeur initiale :
= array(
)

◆ $cliSourcePath

$cliSourcePath = 'cli'
protected

◆ $componentName

$componentName = 'com_foobar'
protected

◆ $componentTitle

$componentTitle = 'Foobar Component'
protected

◆ $fofSourcePath

$fofSourcePath = 'fof'
protected

◆ $installation_queue

$installation_queue
protected
Valeur initiale :
= array(
'modules' => array(
'admin' => array(),
'site' => array()
),
'plugins' => array(
'system' => array(),
)
)

◆ $isPaid

$isPaid = false
protected

◆ $maximumJoomlaVersion

$maximumJoomlaVersion = '3.9.99'
protected

◆ $minimumJoomlaVersion

$minimumJoomlaVersion = '2.5.6'
protected

◆ $minimumPHPVersion

$minimumPHPVersion = '5.3.3'
protected

◆ $modulesSourcePath

$modulesSourcePath = 'modules'
protected

◆ $pluginsSourcePath

$pluginsSourcePath = 'plugins'
protected

◆ $postInstallationMessages

$postInstallationMessages = array()
protected

◆ $removeFilesAllVersions

$removeFilesAllVersions
protected
Valeur initiale :
= array(
'files' => array(
),
'folders' => array(
)
)

◆ $removeFilesFree

$removeFilesFree
protected
Valeur initiale :
= array(
'files' => array(
),
'folders' => array(
)
)

◆ $schemaXmlPath

$schemaXmlPath = 'sql/xml'
protected

◆ $schemaXmlPathRelative

$schemaXmlPathRelative = true
protected

◆ $strapperSourcePath

$strapperSourcePath = 'strapper'
protected

◆ $uninstallation_queue

$uninstallation_queue
protected
Valeur initiale :
= array(
'modules' => array(
'admin' => array(),
'site' => array()
),
'plugins' => array(
'system' => array(),
)
)

La documentation de cette classe a été générée à partir du fichier suivant :