0) { // er is een match, dit is dus een ontbrekend veld in de database if (msTools::checkLastError('msSanitizeLogger', $message)) { //deze fout treed nu al voor de tweede keer op. msTools::notifyDeveloper($message); echo "\n

Er is een onherstelbare fout opgetreden: {$message}
\n"; if (SF_ENVIRONMENT == 'dev') { debug_print_backtrace(); } exit(); } $table = $ar[1][0]; $field = strtolower($ar[2][0]); msTools::symfony_propel_build_sql(); $path = getcwd().'/../data/sql'; $dh = opendir($path); while ($file = readdir($dh)) { if ($file[0] == '.') continue; $sqlfile = file_get_contents("{$path}/{$file}"); preg_match_all("/CREATE TABLE `{$table}`(.+?);/s", $sqlfile, $ar2); if (count($ar2[0]) > 0) { preg_match_all("/`{$field}`(.+)/", $ar2[0][0], $ar3); if (isset($ar3[0][0])) { $insert = trim($ar3[0][0],','); $query = "ALTER TABLE `{$table}` ADD {$insert}"; $message = "Veld {$field} toegevoegd aan tabel {$table}\n{$query}\n{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $this->modifyAndConfirm($message, $query); } } } $this->modifyAndConfirm("Onbekend veld {$field} in tabel {$table}\n{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}", false); } preg_match_all("/\[Native Error: Table '(.+?)\.(.+?)' doesn/", $message, $ar); if (count($ar[0]) > 0) { if (msTools::checkLastError('msSanitizeLogger', $message)) { //deze fout treed nu al voor de tweede keer op. msTools::notifyDeveloper($message); echo "\n

Er is een onherstelbare fout opgetreden: {$message}
\n"; exit(); } $database = $ar[1][0]; $table = strtolower($ar[2][0]); msTools::symfony_propel_build_sql(); $path = getcwd().'/../data/sql'; $dh = opendir($path); while ($file = readdir($dh)) { if ($file[0] == '.') continue; $sqlfile = file_get_contents("{$path}/{$file}"); preg_match_all("/CREATE TABLE `{$table}`(.+?);/s", $sqlfile, $ar2); if (count($ar2[0]) > 0) { $query = $ar2[0][0]; $message = "Tabel {$table} toegevoegd aan database {$database}\n\n{$query}\n\n{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $this->modifyAndConfirm($message, $query); } } } } } /** * Executes the shutdown method. */ public function shutdown() { } public function modifyAndConfirm($message, $query) { if ($query) { $connection = Propel::getConnection(); $statement = $connection->createStatement(); $rs = $statement->executeQuery( $query , ResultSet::FETCHMODE_ASSOC); } /* if (file_exists(getcwd().'/../config/developers.yml')) { $developers = sfYaml::load(file_get_contents(getcwd().'/../config/developers.yml')); foreach ($developers as $developer) { $notify = NotifyProvider::getInstance($developer['notify']); $notify->addAddressee($developer['email']); $notify->setMessage($message); $notify->send(); } } // default notify $notify = NotifyProvider::getInstance('Email'); $notify->addAddressee('support@mindbench.nl'); $notify->setMessage($message); $notify->send(); */ msTools::notifyDeveloper($message); // er is al output gegenereerd, we kunnen dus niet headeren echo ""; exit; } }