Skip to content

Commit

Permalink
Merge pull request #340 from joomla/update
Browse files Browse the repository at this point in the history
Add docu for new update event
  • Loading branch information
HLeithner authored Jan 27, 2025
2 parents 973c792 + 65fb461 commit 56600d5
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/building-extensions/plugins/plugin-events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ The event Group refers to the group of plugins which Joomla ensures are imported
| [onContentBeforeChangeState](./content.md#oncontentbeforechangestate) | In Model, before a set of records changes state | Content | 4.0 |
| [onContentChangeState](./content.md#oncontentchangestate) | In Model, after a set of records changes state | Content | before 4.0 |
| [onCategoryChangeState](./content.md#oncategorychangestate) | In Model, before a set of category records changes state | Content | before 4.0 |
| [onInstallerBeforePackageDownload](./installer.md#oninstallerbeforepackagedownload) | In Installer, before a package is downloaded | Installer | before 4.0 |
| [onInstallerBeforeUpdateSiteDownload](./installer.md#oninstallerbeforeupdatesitedownload) | In Installer, before an update site is downloaded | Installer | 5.3 |

68 changes: 68 additions & 0 deletions docs/building-extensions/plugins/plugin-events/installer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
sidebar_position: 1
title: Installer Events
toc_max_heading_level: 2
---

Installer Events
================


Installer plugin events are triggered when some routines are performed during the install process of extensions or when their update sites are downloaded.

## onInstallerBeforePackageDownload

### Description

This event will be executed before an installable package (zip file) of an extension (package, component, module, plugin, template, library) is downloaded. It allows plugins to modify the url or headers for the request.


### Event Arguments

The event class `\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent` has the following arguments:


- **`url`** - The url of the package.

- **`headers`** - The headers which are sent with the request.

### Return Value

None.

### Examples

```php
public function onInstallerBeforePackageDownload(\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent $event): void
{
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```

## onInstallerBeforeUpdateSiteDownload

### Description

This event will be executed before an update site is downloaded. It allows to modify the url or headers for the request.

### Event Arguments

The event class `\Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent` has the following arguments:


- **`url`** - The url of the update site.

- **`headers`** - The headers which are sent with the request.

### Return Value

None.

### Examples

```php
public function onInstallerBeforeUpdateSiteDownload(\Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent $event): void
{
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```
14 changes: 14 additions & 0 deletions migrations/52-53/new-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,17 @@ $this->form
// Code in the form layout
echo $this->form->renderControlFields();
```

#### New before download update site event

A new event is available where an installer plugin can hook in before an update site url is fetched. Similar to what we have for package download of an extension.

PR: https://github.com/joomla/joomla-cms/pull/44516

The event can be used like:
```php
public function onInstallerBeforeUpdateSiteDownload(\Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent $event): void
{
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ The event Group refers to the group of plugins which Joomla ensures are imported
| [onContentBeforeChangeState](./content.md#oncontentbeforechangestate) | In Model, before a set of records changes state | Content | 4.0 |
| [onContentChangeState](./content.md#oncontentchangestate) | In Model, after a set of records changes state | Content | before 4.0 |
| [onCategoryChangeState](./content.md#oncategorychangestate) | In Model, before a set of category records changes state | Content | before 4.0 |
| [onInstallerBeforePackageDownload](./installer.md#oninstallerbeforepackagedownload) | In Installer, before a package is downloaded | Installer | before 4.0 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_position: 1
title: Installer Events
toc_max_heading_level: 2
---

Installer Events
================


Installer plugin events are triggered when some routines are performed during the install process of extensions or when their update sites are downloaded.

## onInstallerBeforePackageDownload

### Description

This event will be executed before an installable package (zip file) of an extension (package, component, module, plugin, template, library) is downloaded. It allows plugins to modify the url or headers for the request.


### Event Arguments

The event class `\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent` has the following arguments:


- **`url`** - The url of the package.

- **`headers`** - The headers which are sent with the request.

### Return Value

None.

### Examples

```php
public function onInstallerBeforePackageDownload(\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent $event): void
{
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ The event Group refers to the group of plugins which Joomla ensures are imported
| [onContentBeforeChangeState](./content.md#oncontentbeforechangestate) | In Model, before a set of records changes state | Content | 4.0 |
| [onContentChangeState](./content.md#oncontentchangestate) | In Model, after a set of records changes state | Content | before 4.0 |
| [onCategoryChangeState](./content.md#oncategorychangestate) | In Model, before a set of category records changes state | Content | before 4.0 |
| [onInstallerBeforePackageDownload](./installer.md#oninstallerbeforepackagedownload) | In Installer, before a package is downloaded | Installer | before 4.0 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_position: 1
title: Installer Events
toc_max_heading_level: 2
---

Installer Events
================


Installer plugin events are triggered when some routines are performed during the install process of extensions or when their update sites are downloaded.

## onInstallerBeforePackageDownload

### Description

This event will be executed before an installable package (zip file) of an extension (package, component, module, plugin, template, library) is downloaded. It allows plugins to modify the url or headers for the request.


### Event Arguments

The event class `\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent` has the following arguments:


- **`url`** - The url of the package.

- **`headers`** - The headers which are sent with the request.

### Return Value

None.

### Examples

```php
public function onInstallerBeforePackageDownload(\Joomla\CMS\Event\Installer\BeforePackageDownloadEvent $event): void
{
$event->updateUrl($event->getUrl() . '?auth=foo');
}
```

0 comments on commit 56600d5

Please sign in to comment.