Skip to content

Commit f8ed9eb

Browse files
author
Blake Bertuccelli-Booth
authored
Hotfix to populate global meta.
1 parent 9f0eb20 commit f8ed9eb

1 file changed

Lines changed: 44 additions & 23 deletions

File tree

models/db.php

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -839,38 +839,59 @@ public static function create_meta_table(){
839839
// Query 1
840840
self::query($sql_1, $params, false);
841841

842-
// Now, create the content in the meta table with axe
843-
// as the default integration.
842+
// Let's create the params first, so we can do special
843+
// things with them and global meta variables.
844+
$params = array();
845+
846+
// Optionally set global meta variables.
847+
if(isset($GLOBALS['wave_key'])){
848+
$wave_sql = "('wave_key', ?),";
849+
$params[] = $GLOBALS['wave_key'];
850+
}else{
851+
$wave_sql = '';
852+
}
853+
if(isset($GLOBALS['axe_uri'])){
854+
$axe_sql = "('axe_uri', ?),";
855+
$params[] = $GLOBALS['axe_uri'];
856+
}else{
857+
$axe_sql = '';
858+
}
859+
860+
// Now, create the content in the meta table.
844861
$sql_2 = "
845862
INSERT INTO `meta` (meta_name, meta_value)
846-
VALUES
847-
('active_integrations', ?),
863+
VALUES".
864+
$wave_sql.
865+
$axe_sql.
866+
"('active_integrations', ?),
848867
('scan_status', ?),
849868
('scan_schedule', ?),
850869
('scan_log', ?),
851870
('scannable_pages', ?),
852-
('axe_key', ?),
853871
('pages_scanned', ?),
854872
('last_scan_time', ?);
855873
";
856-
$default_active_integrations = serialize(array('axe'));
857-
$default_scan_status = '';
858-
$default_scan_schedule = 'manually';
859-
$default_scan_log = '';
860-
$default_scannable_pages = serialize(array());
861-
$default_axe_key = '';
862-
$default_last_scan_time = '';
863-
$default_pages_scanned = 0;
864-
$params = array(
865-
$default_active_integrations,
866-
$default_scan_status,
867-
$default_scan_schedule,
868-
$default_scan_log,
869-
$default_scannable_pages,
870-
$default_axe_key,
871-
$default_pages_scanned,
872-
$default_last_scan_time
873-
);
874+
875+
// Default active_integrations.
876+
$params[] = serialize(array('axe'));
877+
878+
// Default scan_status.
879+
$params[] = '';
880+
881+
// Default scan_schedule.
882+
$params[] = 'manually';
883+
884+
// Default scan_log.
885+
$params[] = '';
886+
887+
// Default scannable_pages.
888+
$params[] = serialize(array());
889+
890+
// Default last_scan_time.
891+
$params[] = '';
892+
893+
// Default pages_scanned.
894+
$params[] = 0;
874895

875896
// Query 2
876897
self::query($sql_2, $params, false);

0 commit comments

Comments
 (0)