/** * neue System-Optionen bei Update erzeugen * @return bool */ private function addSystemOptions() { $yatdl = new \fpcm\model\system\yatdl(\fpcm\classes\baseconfig::$dbStructPath . '06config.yml'); $yatdl->parse(); $data = $yatdl->getArray(); if (!isset($data['defaultvalues']['rows']) || !count($data['defaultvalues']['rows'])) { return true; } $res = true; foreach ($data['defaultvalues']['rows'] as $option) { $res = $res && $this->config->add($option['config_name'], $option['config_value']); } return $res; }
/** * Parst YaTDL-Datei und führt SQL-Statement aus * @param string $path * @return boolean * @since FPCM 3.2.0 */ public function execYaTdl($path) { if (substr($path, -4) !== '.yml') { $path .= '.yml'; } $yatdl = new \fpcm\model\system\yatdl($path); if ($yatdl->parse() !== true) { trigger_error('An YaTDL parser error occurred!'); return false; } $sql = str_replace('{{dbpref}}', $this->getDbprefix(), $yatdl->getSqlString()); $this->lastQueryString = $sql; if (defined('FPCM_DEBUG') && FPCM_DEBUG && defined('FPCM_DEBUG_SQL') && FPCM_DEBUG_SQL) { logs::sqllogWrite($sql); } try { $res = $this->connection->exec($sql); } catch (\PDOException $e) { logs::sqllogWrite($e); } if ($res === false) { $this->getError(); return false; } return true; }