template files
This commit is contained in:
@@ -0,0 +1 @@
|
||||
A000001
|
||||
@@ -0,0 +1 @@
|
||||
A000002
|
||||
@@ -0,0 +1 @@
|
||||
A000003
|
||||
@@ -0,0 +1 @@
|
||||
A000004
|
||||
@@ -0,0 +1 @@
|
||||
A000005
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user