-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install Tag1 Drupal 7 Extended Support (D7ES) module.
To receive security ongoing security coverage for your contrib modules, apply this upstream update then enable the Tag1 D7ES module. See our docs for full details: https://docs.pantheon.io/supported-drupal#d7es-usage
- Loading branch information
1 parent
216e37b
commit 9b83aee
Showing
7 changed files
with
1,477 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# tag1_d7es | ||
|
||
Drupal 7 module to support Tag1's D7ES offering. | ||
|
||
Installation and use of this module constitutes your acceptance of and agreement | ||
to be bound by Tag1 Consulting Inc's Terms of Service and Privacy Policy, | ||
as published at D7ES.Tag1.com. | ||
|
||
## Requirements | ||
* A properly configured [cron job](https://www.drupal.org/docs/7/setting-up-cron/overview) | ||
* An active customer account created at https://d7es.tag1.com/ | ||
|
||
## Configuration | ||
1. Download and enable the module as usual. | ||
2. Visit the module's configuration page at `/admin/config/system/tag1-d7es` and | ||
enter the Billing email address used when creating the customer account. You | ||
will also need to supply one or more email addresses that should be notified of | ||
available security updates. | ||
3. Save the form. Status messages will let you know if the site is authenticated | ||
and sending data successfully. | ||
|
||
## How does it work? | ||
This module will report the following information about your site to the Tag1 | ||
D7ES team: | ||
|
||
* the version of Drupal core | ||
* name and version of contributed modules and themes | ||
* database type and version | ||
* PHP version | ||
* the URL of your website | ||
* the billing account email address | ||
* list of email addresses who should be notified when a security update is available | ||
|
||
This report is submitted via a cron job a maximum of once per 24 hours. | ||
|
||
The full JSON payload sent by your site may be previewed from the module's | ||
configuration page under the "Debugging" fieldset. | ||
|
||
## For extra security | ||
|
||
For extra security, you may wish to configure the "Billing email address" and | ||
"Notification email addresses" outside of the site's database. You can use the | ||
variables `tag1_d7es_billing_email` and `tag1_d7es_email_addresses` to define | ||
these values directly in settings.php, or by calling an environment variable. | ||
|
||
```php | ||
// Including value in code. | ||
$conf['tag1_d7es_billing_email'] = '[email protected]'; | ||
|
||
// Sourcing from an environment variable. | ||
$conf['tag1_d7es_billing_email'] = $_ENV['MY_BILLING_EMAIL_VARIABLE']; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
// phpcs:ignoreFile | ||
/** | ||
* @file | ||
* Enables our module to use UUIDs without the UUID or CTools modules enabled. | ||
*/ | ||
|
||
/** | ||
* Pattern for detecting a valid UUID. | ||
*/ | ||
if (!defined('UUID_PATTERN')) { | ||
define('UUID_PATTERN', '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}'); | ||
} | ||
|
||
/** | ||
* Generates a UUID using the Windows internal GUID generator. | ||
* | ||
* @see http://php.net/com_create_guid | ||
*/ | ||
function _tag1_d7es_uuid_generate_com() { | ||
// Remove {} wrapper and make lower case to keep result consistent. | ||
return drupal_strtolower(trim(com_create_guid(), '{}')); | ||
} | ||
|
||
/** | ||
* Generates an universally unique identifier using the PECL extension. | ||
*/ | ||
function _tag1_d7es_uuid_generate_pecl() { | ||
$uuid_type = UUID_TYPE_DEFAULT; | ||
return uuid_create($uuid_type); | ||
} | ||
|
||
/** | ||
* Generates a UUID v4 using PHP code. | ||
* | ||
* Based on code from @see http://php.net/uniqid#65879 , but corrected. | ||
*/ | ||
function _tag1_d7es_uuid_generate_php() { | ||
// The field names refer to RFC 4122 section 4.1.2. | ||
return sprintf('%04x%04x-%04x-4%03x-%04x-%04x%04x%04x', | ||
// 32 bits for "time_low". | ||
mt_rand(0, 65535), mt_rand(0, 65535), | ||
// 16 bits for "time_mid". | ||
mt_rand(0, 65535), | ||
// 12 bits after the 0100 of (version) 4 for "time_hi_and_version". | ||
mt_rand(0, 4095), | ||
bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '10', 0, 2)), | ||
// 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res" | ||
// (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d) | ||
// 8 bits for "clk_seq_low" 48 bits for "node". | ||
mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535) | ||
); | ||
} | ||
|
||
// This is wrapped in an if block to avoid conflicts with PECL's uuid_is_valid(). | ||
/** | ||
* Check that a string appears to be in the format of a UUID. | ||
* | ||
* @param $uuid | ||
* The string to test. | ||
* | ||
* @return | ||
* TRUE if the string is well formed. | ||
*/ | ||
if (!function_exists('uuid_is_valid')) { | ||
function uuid_is_valid($uuid) { | ||
return preg_match('/^' . UUID_PATTERN . '$/', $uuid); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name = Tag1 D7ES | ||
description = Module that communicates with Tag1's D7ES service. <br/>Installation and use of this module constitutes your acceptance of and agreement to be bound by Tag1 Consulting Inc's Terms of Service and Privacy Policy, as published at <a href="https://d7es.tag1.com/">D7ES.Tag1.com</a>. | ||
core = 7.x | ||
package = Tag1 | ||
configure = admin/config/system/tag1-d7es | ||
files[] = tests/tag1_d7es.test | ||
files[] = tests/tag1_d7es_ctools.test | ||
files[] = tests/tag1_d7es_admin.test | ||
files[] = tests/tag1_d7es_admin_ctools.test | ||
files[] = tests/tag1_d7es_fetch_url.test | ||
files[] = tests/tag1_d7es_mail.test | ||
files[] = tests/tag1_d7es_update.test | ||
|
||
; Information added by Drupal.org packaging script on 2024-11-27 | ||
version = "7.x-1.1" | ||
core = "7.x" | ||
project = "tag1_d7es" | ||
datestamp = "1732731772" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains install and update functions for tag1_d7es. | ||
*/ | ||
|
||
/** | ||
* Implements hook_install(). | ||
*/ | ||
function tag1_d7es_install() { | ||
variable_set('tag1_d7es_site_id', tag1_d7es_uuid_generate()); | ||
if (variable_get('update_fetch_url')) { | ||
variable_set('tag1_d7es_original_update_fetch_url', variable_get('update_fetch_url')); | ||
} | ||
variable_set('tag1_d7es_phone_home', 0); | ||
variable_set('tag1_d7es_send_update_emails', 0); | ||
drupal_set_message(t('Thank you for installing Tag1 D7ES. Please proceed to the <a href="/admin/config/system/tag1-d7es">configuration page</a> to configure authentication and notifications. Installation and use of this module constitutes your acceptance of and agreement to be bound by Tag1 Consulting Inc\'s Terms of Service and Privacy Policy, as published at D7ES.Tag1.com.')); | ||
} | ||
|
||
/** | ||
* Implements hook_uninstall(). | ||
*/ | ||
function tag1_d7es_uninstall() { | ||
if (variable_get('tag1_d7es_original_update_fetch_url')) { | ||
variable_set('update_fetch_url', variable_get('tag1_d7es_original_update_fetch_url')); | ||
variable_del('tag1_d7es_original_update_fetch_url'); | ||
} | ||
else { | ||
variable_del('update_fetch_url'); | ||
} | ||
variable_del('tag1_d7es_site_id'); | ||
variable_del('tag1_d7es_phone_home'); | ||
variable_del('tag1_d7es_billing_email'); | ||
variable_del('tag1_d7es_email_addresses'); | ||
variable_del('tag1_d7es_endpoint'); | ||
variable_del('tag1_d7es_send_update_emails'); | ||
} | ||
|
||
/** | ||
* Implements hook_requirements(). | ||
*/ | ||
function tag1_d7es_requirements($phase) { | ||
$requirements = array(); | ||
|
||
// Display reporting status. | ||
if ($phase == 'runtime') { | ||
$description = ''; | ||
$last_phone_home = variable_get('tag1_d7es_phone_home'); | ||
if ($last_phone_home == 0) { | ||
$value = t('Never'); | ||
$description = t('The Tag1 D7ES module has not successfully connected. Please visit the <a href="/admin/config/system/tag1-d7es">configuration page</a> to configure authentication and notifications.'); | ||
$severity = REQUIREMENT_ERROR; | ||
} | ||
elseif (is_null(variable_get('tag1_d7es_billing_email')) || is_null(variable_get('tag1_d7es_email_addresses'))) { | ||
$value = t('Missing configuration'); | ||
$description = t('The Tag1 D7ES module is missing key configuration. Please visit the <a href="/admin/config/system/tag1-d7es">configuration page</a> to configure authentication and notifications.'); | ||
$severity = REQUIREMENT_ERROR; | ||
} | ||
elseif ($last_phone_home <= REQUEST_TIME - 604800) { | ||
$value = t('Last run: %phone-home-last ago.', array( | ||
'%phone-home-last' => format_interval(REQUEST_TIME - $last_phone_home), | ||
)); | ||
$description = t('Last report sent over a week ago. Please check that cron is running successfully.'); | ||
$severity = REQUIREMENT_WARNING; | ||
} | ||
else { | ||
$value = t('Last run: %phone-home-last ago.', array( | ||
'%phone-home-last' => format_interval(REQUEST_TIME - $last_phone_home), | ||
)); | ||
$severity = REQUIREMENT_OK; | ||
} | ||
|
||
$requirements['tag1_d7es'] = array( | ||
'title' => 'Tag1 D7ES', | ||
'value' => $value, | ||
'description' => $description, | ||
'severity' => $severity, | ||
); | ||
} | ||
|
||
return $requirements; | ||
} | ||
|
||
/** | ||
* Set update_fetch_url if able. | ||
*/ | ||
function tag1_d7es_update_7100(&$sandbox) { | ||
if (variable_get('update_fetch_url')) { | ||
variable_set('tag1_d7es_original_update_fetch_url', variable_get('update_fetch_url')); | ||
} | ||
if (variable_get('tag1_d7es_phone_home')) { | ||
variable_set('update_fetch_url', tag1_d7es_personalize_updates_endpoint()); | ||
} | ||
} |
Oops, something went wrong.
9b83aee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created multidev environment ci-546 for ci-update-drops-7.