Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docu for new update event #340

Merged
merged 16 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |

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

Installer Events
==============
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

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:
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

- **`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:
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

- **`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');
}
```
13 changes: 13 additions & 0 deletions migrations/52-53/new-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,16 @@ $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.
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

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,39 @@
---
sidebar_position: 1
title: Installer Events
toc_max_heading_level: 2
---

Installer Events
==============
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

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:
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

- **`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,39 @@
---
sidebar_position: 1
title: Installer Events
toc_max_heading_level: 2
---

Installer Events
==============
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

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:
robbiejackson marked this conversation as resolved.
Show resolved Hide resolved

- **`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');
}
```