Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
406 changes: 15 additions & 391 deletions CRM/Webhook/DAO/WebhookLegacy.php

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion CRM/Webhook/Form/WebhookSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function buildQuickForm(): void
ts('more'),
false,
'view.webhook.row',
'Webhook',
'WebhookLegacy',
$hook['id'],
);
}
Expand All @@ -64,13 +64,15 @@ public function links(): array
'qs' => 'id=%%id%%',
'title' => ts('Edit webhook'),
'class' => 'crm-popup webhook-action',
'weight' => 0,
],
CRM_Core_Action::DELETE => [
'name' => ts('Delete'),
'url' => 'civicrm/admin/webhooks/delete',
'qs' => 'id=%%id%%',
'title' => ts('Delete webhook'),
'class' => 'crm-popup webhook-action',
'weight' => 1,
],
];
}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ The extension is licensed under [AGPL-3.0](LICENSE.txt).

## Requirements

- PHP v7.3+
- CiviCRM v5.61+
- rc-base
- PHP v7.3+
- CiviCRM v5.76+
- rc-base

## Installation

Expand All @@ -40,7 +40,7 @@ If the selector is `my-hook-handler`, then the endpoint of the listener applicat

The extension does not provide upgrader process for v1 -> v2 migration. The supported way is the following:

- Uninstall v1
- Install v2
- Uninstall v1
- Install v2

The v1 configurations will be lost in this process.
16 changes: 8 additions & 8 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
<url desc="Support">https://github.com/reflexive-communications/webhook-admin/issues</url>
<url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-11-24</releaseDate>
<version>4.0.0</version>
<releaseDate>2025-02-05</releaseDate>
<version>4.1.0</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.61</ver>
<ver>5.76</ver>
</compatibility>
<requires>
<ext>rc-base</ext>
Expand All @@ -36,13 +36,13 @@
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
<mixins>
<mixin>menu-xml@1.0.0</mixin>
<mixin>smarty-v2@1.0.1</mixin>
<mixin>entity-types-php@1.0.0</mixin>
<mixin>entity-types-php@2</mixin>
<mixin>menu-xml@1</mixin>
<mixin>smarty@1</mixin>
</mixins>
<upgrader>CRM_Webhook_Upgrader</upgrader>
<upgrader>CiviMix\Schema\Webhook\AutomaticUpgrader</upgrader>
<civix>
<namespace>CRM/Webhook</namespace>
<format>23.02.1</format>
<format>24.09.1</format>
</civix>
</extension>
Binary file added mixin/lib/civimix-schema@5.80.2.phar
Binary file not shown.
107 changes: 107 additions & 0 deletions schema/WebhookLegacy.entityType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

use CRM_Webhook_ExtensionUtil as E;

return [
'name' => 'WebhookLegacy',
'table' => 'civicrm_webhook_legacy',
'class' => 'CRM_Webhook_DAO_WebhookLegacy',
'getInfo' => fn() => [
'title' => E::ts('Webhook'),
'title_plural' => E::ts('Webhooks'),
'description' => E::ts('Webhook configs'),
'log' => false,
],
'getIndices' => fn() => [
'index_query' => [
'fields' => [
'query_string' => true,
],
'unique' => true,
],
],
'getFields' => fn() => [
'id' => [
'title' => E::ts('Webhook ID'),
'sql_type' => 'int unsigned',
'input_type' => 'Number',
'required' => true,
'description' => E::ts('Unique Webhook ID'),
'primary_key' => true,
'auto_increment' => true,
],
'name' => [
'title' => E::ts('Name'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Webhook name'),
'default' => null,
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
'description' => [
'title' => E::ts('Description'),
'sql_type' => 'text',
'input_type' => 'Text',
'description' => E::ts('Webhook description'),
'default' => null,
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
'handler' => [
'title' => E::ts('Handler'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Handler class'),
'default' => null,
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
'query_string' => [
'title' => E::ts('Query string'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Webhook query parameter'),
'default' => null,
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
'processor' => [
'title' => E::ts('Processor'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Processor class'),
'default' => null,
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
'options' => [
'title' => E::ts('Custom options'),
'sql_type' => 'text',
'input_type' => 'Text',
'description' => E::ts('Custom serialized data for PHP'),
'default' => null,
'serialize' => constant('CRM_Core_DAO::SERIALIZE_PHP'),
'usage' => [
'import',
'export',
'duplicate_matching',
],
],
],
];
47 changes: 0 additions & 47 deletions sql/auto_install.sql

This file was deleted.

20 changes: 0 additions & 20 deletions sql/auto_uninstall.sql

This file was deleted.

39 changes: 39 additions & 0 deletions webhook.civix.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,45 @@ public static function findClass($suffix)
return self::CLASS_PREFIX.'_'.str_replace('\\', '_', $suffix);
}

/**
* @return \CiviMix\Schema\SchemaHelperInterface
*/
public static function schema()
{
if (!isset($GLOBALS['CiviMixSchema'])) {
pathload()->loadPackage('civimix-schema@5', true);
}

return $GLOBALS['CiviMixSchema']->getHelper(static::LONG_NAME);
}

}

pathload()->addSearchDir(__DIR__.'/mixin/lib');
spl_autoload_register('_webhook_civix_class_loader', true, true);

function _webhook_civix_class_loader($class)
{
if ($class === 'CRM_Webhook_DAO_Base') {
if (version_compare(CRM_Utils_System::version(), '5.74.beta', '>=')) {
class_alias('CRM_Core_DAO_Base', 'CRM_Webhook_DAO_Base');
// ^^ Materialize concrete names -- encourage IDE's to pick up on this association.
} else {
$realClass = 'CiviMix\\Schema\\Webhook\\DAO';
class_alias($realClass, $class);
// ^^ Abstract names -- discourage IDE's from picking up on this association.
}

return;
}

// This allows us to tap-in to the installation process (without incurring real file-reads on typical requests).
if (strpos($class, 'CiviMix\\Schema\\Webhook\\') === 0) {
// civimix-schema@5 is designed for backported use in download/activation workflows,
// where new revisions may become dynamically available.
pathload()->loadPackage('civimix-schema@5', true);
CiviMix\Schema\loadClass($class);
}
}

/**
Expand Down
9 changes: 0 additions & 9 deletions xml/schema/CRM/Webhook/WebhookLegacy.entityType.php

This file was deleted.

Loading