/** * @param ContainerInterface $container * @param JarvesConfig $jarvesConfig * @return CacheInterface */ public static function createDistributed(ContainerInterface $container, JarvesConfig $jarvesConfig) { $cacheConfig = $jarvesConfig->getSystemConfig()->getCache(true); $service = $cacheConfig->getService(); /** @var CacheInterface $instance */ $instance = $container->get($service); $instance->configure($cacheConfig); return $instance; }
/** * @param string $path * @return \Jarves\Model\File[] */ public function getFiles($path) { $items = parent::getFiles($path); $fs = $this->getAdapter($path); if ($fs->getMountPath()) { foreach ($items as &$file) { $file->setMountPoint($fs->getMountPath()); } } if ('/' === $path) { foreach ($this->jarvesConfig->getSystemConfig()->getMountPoints() as $mountPoint) { $fileInfo = new FileInfo(); $fileInfo->setPath('/' . $mountPoint->getPath()); // $fileInfo->setIcon($mountPoint->getIcon()); $fileInfo->setType(FileInfo::DIR); $fileInfo->setMountPoint(true); array_unshift($items, $fileInfo); } } return $this->wrap($items); }
/** * @ApiDoc( * section="System configuration", * description="Returns the system configuration" * ) * * * @Rest\Get("/admin/system/config") * * @return array */ public function getConfigAction() { return $this->jarvesConfig->getSystemConfig()->toArray(true); }
/** * @deprecated use jarvesConfig->getSystemConfig * @return SystemConfig */ public function getSystemConfig() { return $this->jarvesConfig->getSystemConfig(); }
/** * @param array $conditionRule * @param array $params * @param string $objectKey * @param array $usedFieldNames * @return string */ public function singleConditionToSql(Condition $condition, $conditionRule, &$params, $objectKey, &$usedFieldNames = null) { if ($conditionRule[0] === null) { return ''; } $tableName = ''; if ($condition->isTableNameSet()) { //custom tableName overwrites the tableName from the object definition (for alias use cases for example) $tableName = $condition->getTableName(); } $def = $this->objects->getDefinition($objectKey); if ($def && !$tableName) { $tableName = $def->getTable(); } $columnName = $fieldName = $conditionRule[0]; if (false !== ($pos = strpos($fieldName, '.'))) { $tableName = substr($fieldName, 0, $pos); $columnName = $fieldName = substr($fieldName, $pos + 1); } if ($def) { $field = $def->getField($fieldName); if ($field) { $columns = $field->getFieldType()->getColumns(); if (!$columns) { throw new \RuntimeException("Field {$fieldName} ({$field->getType()}) does not have columns"); } $columnName = Tools::camelcase2Underscore($columns[0]->getName()); } } else { $columnName = Tools::camelcase2Underscore($fieldName); } if (null !== $usedFieldNames) { $usedFieldNames[] = $fieldName; } if (!is_numeric($conditionRule[0])) { $result = ($tableName ? Tools::dbQuote($tableName) . '.' : '') . Tools::dbQuote($columnName) . ' '; } else { $result = $conditionRule[0]; } if (strtolower($conditionRule[1]) == 'regexp') { $result .= strtolower($this->jarvesConfig->getSystemConfig()->getDatabase()->getMainConnection()->getType()) == 'mysql' ? 'REGEXP' : '~'; } else { $result .= $conditionRule[1]; } if (!is_numeric($conditionRule[0])) { if (isset($conditionRule[2]) && $conditionRule[2] !== null) { if ($conditionRule[2] instanceof ConditionSubSelect) { $result .= ' (' . $this->subSelectConditionToSql($conditionRule[2], $params, $objectKey, $usedFieldNames) . ') '; } else { $params[':p' . (count($params) + 1)] = $conditionRule[2]; $p = ':p' . count($params); if (strtolower($conditionRule[1]) == 'in' || strtolower($conditionRule[1]) == 'not in') { $result .= " ({$p})"; } else { $result .= ' ' . $p; } } } } else { $result .= ' ' . ($conditionRule[0] + 0); } return $result; }