From 2b7f61f103f7a4213797b4c284fd1fec686c7e39 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 18 Jan 2025 23:25:43 -0500 Subject: [PATCH] template files --- ANSIBLE/templates/A000001.yml | 1 + ANSIBLE/templates/A000002.yml | 1 + ANSIBLE/templates/A000003.yml | 1 + ANSIBLE/templates/A000004.yml | 1 + ANSIBLE/templates/A000005.yml | 1 + ANSIBLE/templates/README.md | 12 ++++++++++++ app/Controllers/Home.php | 9 ++++----- 7 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 ANSIBLE/templates/A000001.yml create mode 100644 ANSIBLE/templates/A000002.yml create mode 100644 ANSIBLE/templates/A000003.yml create mode 100644 ANSIBLE/templates/A000004.yml create mode 100644 ANSIBLE/templates/A000005.yml create mode 100644 ANSIBLE/templates/README.md diff --git a/ANSIBLE/templates/A000001.yml b/ANSIBLE/templates/A000001.yml new file mode 100644 index 0000000..e2cf745 --- /dev/null +++ b/ANSIBLE/templates/A000001.yml @@ -0,0 +1 @@ +A000001 \ No newline at end of file diff --git a/ANSIBLE/templates/A000002.yml b/ANSIBLE/templates/A000002.yml new file mode 100644 index 0000000..7769c7e --- /dev/null +++ b/ANSIBLE/templates/A000002.yml @@ -0,0 +1 @@ +A000002 \ No newline at end of file diff --git a/ANSIBLE/templates/A000003.yml b/ANSIBLE/templates/A000003.yml new file mode 100644 index 0000000..50fb5ac --- /dev/null +++ b/ANSIBLE/templates/A000003.yml @@ -0,0 +1 @@ +A000003 \ No newline at end of file diff --git a/ANSIBLE/templates/A000004.yml b/ANSIBLE/templates/A000004.yml new file mode 100644 index 0000000..85901be --- /dev/null +++ b/ANSIBLE/templates/A000004.yml @@ -0,0 +1 @@ +A000004 \ No newline at end of file diff --git a/ANSIBLE/templates/A000005.yml b/ANSIBLE/templates/A000005.yml new file mode 100644 index 0000000..6827259 --- /dev/null +++ b/ANSIBLE/templates/A000005.yml @@ -0,0 +1 @@ +A000005 \ No newline at end of file diff --git a/ANSIBLE/templates/README.md b/ANSIBLE/templates/README.md new file mode 100644 index 0000000..1149055 --- /dev/null +++ b/ANSIBLE/templates/README.md @@ -0,0 +1,12 @@ + +merms_panel=# select name, product_id,status from products; +name | product_id | status +----------------------+------------+-------- +Professional Website | A000002 | 1 +Professional Blog | A000004 | 1 +Practice EMR | A000005 | 1 +Personal Website | A000001 | 5 +Personal Blog | A000003 | 5 +(5 rows) + + diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index b6435ec..561d95f 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -13,7 +13,7 @@ class Home extends BaseController { $public_path = FCPATH; $ansible_folder = str_replace("public/", "ANSIBLE", $public_path); - $mysql = "SELECT id, internal_url FROM members_products"; + $mysql = "SELECT id, internal_url,product_id,status FROM members_products"; $query = $this->db->query($mysql); // $num = $query->num_rows(); $provision_list= $query->getResult(); @@ -21,12 +21,11 @@ class Home extends BaseController foreach ($provision_list as $pr){ $prov_name = str_replace(".", "_", $pr->internal_url).".yml"; + $template_file = $ansible_folder ."/templates/".$pr->product_id.".yml"; + $template_content = file_get_contents($template_file); $myfile = fopen( $ansible_folder ."/".$prov_name, "w") or die("Unable to open file!"); - $txt = "John Doe\n"; - fwrite($myfile, $txt); - $txt = "Jane Doe\n"; - fwrite($myfile, $txt); + fwrite($myfile, $template_content); fclose($myfile); }