public function getConfigTypesList($repositoryName) { $configTypes = array(); if ($this->hasRepository($repositoryName)) { $path = $this->getCMDLDirectory() . '/' . $repositoryName . '/config'; $path = realpath($path); if (is_dir($path)) { $results = scandir($path); foreach ($results as $result) { if ($result === '.' || $result === '..') { continue; } if (!is_dir($path . '/' . $result)) { if (pathinfo($result, PATHINFO_EXTENSION) == 'cmdl') { $filestats = stat($path . '/' . $result); $configTypeName = pathinfo($result, PATHINFO_FILENAME); $configTypeDefinition = $this->getConfigTypeDefinition($repositoryName, $configTypeName); if ($configTypeDefinition) { $info = new ConfigTypeInfo(); $info->setName($configTypeName); $info->setLastchangecmdl(@$filestats['mtime']); $info->setTitle((string) $configTypeDefinition->getTitle()); $info->setDescription((string) $configTypeDefinition->getDescription()); $configTypes[$configTypeName] = $info; } } } } } } return $configTypes; }
public function getConfigTypesList($repositoryName) { $configTypes = array(); /** @var PDO $db */ $dbh = $this->app['db']->getConnection(); $sql = 'SELECT name, lastchange_timestamp FROM _cmdl_ WHERE repository = ? AND data_type = "config" ORDER BY name'; $stmt = $dbh->prepare($sql); try { $stmt->execute(array($repositoryName)); $result = $stmt->fetchAll(); foreach ($result as $row) { $contentTypeDefinition = $this->getConfigTypeDefinition($repositoryName, $row['name']); if ($contentTypeDefinition) { $info = new ConfigTypeInfo(); $info->setName($contentTypeDefinition->getName()); $info->setLastchangecmdl($row['lastchange_timestamp']); $info->setTitle((string) $contentTypeDefinition->getTitle()); $info->setDescription((string) $contentTypeDefinition->getDescription()); $configTypes[$row['name']] = $info; } } } catch (\PDOException $e) { } return $configTypes; }