function install() { if (!$this->db->connect()) { return $this->returnJSON(false, "Could not connect to database " . $this->db->getError()); } if (!$this->db->selectSchema()) { return $this->returnJSON(false, "Could not open database schema '" . MYSQL_DATABASE . "'"); } $installer = new installer($this->db); //Run create table sql file ocreate the tables if (file_exists($this->pathToModule . $this->createTablesSQL)) { $tempReturn = $installer->processSQLfile($this->pathToModule . $this->createTablesSQL); if ($tempReturn !== true) { return $this->returnJSON(false, $tempReturn); } } //end if $thereturn = ""; //now we run the import for each file foreach ($this->tables as $table) { $tempReturn = $installer->processSQLFile($this->pathToModule . $table . ".sql"); if ($tempReturn !== true) { $thereturn .= $tempReturn; } } //end foreach if ($thereturn) { return $this->returnJSON(false, $thereturn); } else { return $this->returnJSON(true, "Module Installed"); } }