Пример #1
0
 function createTables()
 {
     /// check if database exists and filled-in
     $this->db->query("SET NAMES utf8");
     $this->db->query("SET character_set_database=utf8");
     $this->db->query("SET character_set_server=utf8");
     $xml = new Am_DbSync();
     foreach ($this->dbXmlFiles as $fn) {
         $xmlFile = file_get_contents($fn);
         if (!strlen($xmlFile)) {
             throw new Am_Setup_Exception("Could not read XML file [{$fn}] - file does not exists or empty");
         }
         foreach ($this->config as $k => $v) {
             if ($k == self::ADMIN_PASS) {
                 $ph = new PasswordHash(12, true);
                 $xmlFile = str_replace($k, $this->db->quote($ph->HashPassword($v)), $xmlFile);
             } elseif ($k[0] == '@') {
                 $xmlFile = str_replace($k, $this->db->quote($v), $xmlFile);
             }
         }
         $xml->parseXml($xmlFile);
     }
     $db = new Am_DbSync();
     $db->parseTables($this->db);
     $diff = $xml->diff($db);
     $diff->apply($this->db);
 }