MCPcopy Create free account
hub / github.com/EqualifyEverything/equalify / process_integrations

Function process_integrations

helpers/process_integrations.php:30–166  ·  view source on GitHub ↗

* Process Integrations * @param array sites_output */

(array $sites_output)

Source from the content-addressed store, hash-verified

28 * @param array sites_output
29 */
30function process_integrations(array $sites_output){
31
32 // The goal of this process is to set up this array.
33 $integrations_output = array(
34 'processed_sources' => array(),
35 'processed_urls' => array(),
36 'processed_sites' => $sites_output
37 );
38
39 // Let's log our process for the CLI.
40 update_scan_log("\n\n\n> Processing integrations...");
41
42 // We don't know where helpers are being called, so
43 // we must set the directory if it isn't already set.
44 if(!defined('__ROOT__'))
45 define('__ROOT__', dirname(dirname(__FILE__)));
46
47 // We'll use the directory to include required files.
48 require_once(__ROOT__.'/config.php');
49 require_once(__ROOT__.'/models/db.php');
50
51 // This process runs active integrations.
52 $active_integrations = unserialize(
53 DataAccess::get_meta_value('active_integrations')
54 );
55
56 // Without active integrations, there's no reason to continue.
57 if(empty($active_integrations))
58 kill_scan("You have no active integrations.");
59
60 // Let's add these active integrations to our output array.
61 $integrations_output['processed_sources'] = $active_integrations;
62
63 // We'll also log our progress for CLIs.
64 $active_integrations_count = count($active_integrations);
65
66 $logged_progress = "\n> $active_integrations_count active integration";
67 if ($active_integrations_count !== 1) {
68 $logged_progress.='s';
69 }
70 $logged_progress.='.';
71 update_scan_log($logged_progress);
72
73 // If there are no integrations ready to process,
74 // we won't run the process.
75 if (empty($active_integrations)) {
76 return $integrations_output;
77 }
78
79 // Now we run each integration.
80 foreach ($active_integrations as $integration){
81
82 // Every integration file is added using a standard pattern.
83 require_once (
84 __ROOT__.'/integrations/'.$integration.'/functions.php'
85 );
86
87 // (NOTE: A more robust integration interface might use a request generator

Callers 1

scan.phpFile · 0.85

Calls 4

update_scan_logFunction · 0.85
kill_scanFunction · 0.85
get_meta_valueMethod · 0.80

Tested by

no test coverage detected