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

Function process_sites

helpers/process_sites.php:15–136  ·  view source on GitHub ↗

* Process Sites */

()

Source from the content-addressed store, hash-verified

13 * Process Sites
14 */
15function process_sites(){
16
17 // We don't know where helpers are being called, so
18 // we must set the directory if it isn't already set.
19 if(!defined('__ROOT__'))
20 define('__ROOT__', dirname(dirname(__FILE__)));
21
22 // We'll use the directory to include required files.
23 require_once(__ROOT__.'/config.php');
24 require_once(__ROOT__.'/models/db.php');
25 require_once(__ROOT__.'/models/adders.php');
26 require_once(__ROOT__.'/helpers/scan.php');
27
28 // The goal of this process is to set up this array.
29 $sites_output = array();
30
31 // Let's log our process for the CLI.
32 update_scan_log("\n\n\n> Processing sites...");
33
34 // We only run this process on active sites.
35 $filtered_to_active_sites = array(
36 array(
37 'name' => 'status',
38 'value' => 'active'
39 )
40 );
41 $active_sites = DataAccess::get_db_rows( 'sites',
42 $filtered_to_active_sites, 1, 10000
43 )['content'];
44
45 // Log our progress for CLI.
46 $active_sites_count = count($active_sites);
47 echo "\n> $active_sites_count active site";
48 if($active_sites_count > 1 ){
49 echo 's';
50 }
51 echo ':';
52
53 // We run this process if there are sites ready to
54 // process.
55 if(!empty($active_sites)){
56
57 // Pages count is used for logging.
58 $pages_count = 0;
59
60 // Each site is processed individually.
61 foreach($active_sites as $site){
62
63 // Log our progress for CLI.
64 update_scan_log("\n- $site->url");
65
66 // Let's add a 'urls' array to our sites.
67 $site->urls = array();
68
69 // Every URL that is processed is added to
70 // our output.
71 $sites_output[$site->id] = $site;
72

Callers 1

scan.phpFile · 0.85

Calls 8

update_scan_logFunction · 0.85
single_page_adderFunction · 0.85
xml_site_adderFunction · 0.85
wordpress_site_adderFunction · 0.85
kill_scanFunction · 0.85
get_db_rowsMethod · 0.80
get_meta_valueMethod · 0.80
update_meta_valueMethod · 0.80

Tested by

no test coverage detected