Skip to content

Commit

Permalink
Main database functions have been added. This means Greeny should now…
Browse files Browse the repository at this point in the history
… be able to remember where you've been and keep a record of all the new places you might want to take him.
  • Loading branch information
bliswebagency committed Jul 13, 2011
1 parent e1e1478 commit 53c5770
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions greeny/mod.greeny.php
Expand Up @@ -41,8 +41,13 @@ public function update(){
$newrecord = false;
$out = "";
//temp array... this will be replace by an array populated by the db
$roots = array("/var/www/vhosts/mysite.net/subdomains/stage/httpdocs/","/var/www/vhosts/mysite.net/httpdocs/","/var/www/vhosts/mysite.net/subdomains/dev/httpdocs/","/Users/admin/Sites/ee2/");
$results = $this->EE->db->query("SELECT dir_path FROM exp_greeny");
$roots = array();

foreach ($results->result_array() as $row){
array_push($roots, $row['dir_path']);
}

//grab this site's root
$current_root = $_SERVER['DOCUMENT_ROOT'];

Expand All @@ -55,9 +60,12 @@ public function update(){
if (!in_array($current_root,$roots))
{
//whoa, hold your horses! what's this? a new environment? let's make a record of it.
$data = array('dir_path' => $current_root);
$sql = $this->EE->db->insert_string('exp_greeny', $data);
$this->EE->db->query($sql);

//display "new environment recorded"
$out .= "New Environment Recorded...";
$out .= "New Environment Recorded...<br />";

$newrecord = true;
}
Expand Down

0 comments on commit 53c5770

Please sign in to comment.