public static function init_files() { // Don't let the process run multiple times... if (pts_config::$init_process_ran) { return false; } pts_config::$init_process_ran = true; // The main PTS user client config pts_config::user_config_generate(); // Generate the graph config $json_pre = null; if (is_file(PTS_USER_PATH . 'graph-config.json')) { $json_pre = file_get_contents(PTS_USER_PATH . 'graph-config.json'); } else { if (PTS_IS_CLIENT && is_file($t = PTS_CORE_STATIC_PATH . 'graph-config-template-' . phodevi::read_property('system', 'vendor-identifier') . '.json')) { $json_pre = file_get_contents($t); } else { if (is_file(PTS_CORE_STATIC_PATH . 'graph-config-template.json')) { $json_pre = file_get_contents(PTS_CORE_STATIC_PATH . 'graph-config-template.json'); } } } $json_graph = array(); pts_Graph::set_default_graph_values($json_graph); if ($json_pre != null) { $json_pre = json_decode($json_pre, true); if (is_array($json_pre)) { $json_graph = array_merge($json_graph, $json_pre); } } pts_Graph::init_graph_config($json_graph); file_put_contents(PTS_USER_PATH . 'graph-config.json', pts_arrays::json_encode_pretty_string($json_graph)); }