|
@@ -72,12 +72,34 @@ class InstanceConfig {
|
|
|
return DB::getPDO()->fetchFirst("
|
|
return DB::getPDO()->fetchFirst("
|
|
|
select c.*
|
|
select c.*
|
|
|
from `CRM_INSTANCE_CONFIG` c
|
|
from `CRM_INSTANCE_CONFIG` c
|
|
|
- where c.namespace = :namespace'{$namespace}'
|
|
|
|
|
|
|
+ where c.namespace = :namespace
|
|
|
", [
|
|
", [
|
|
|
':namespace' => $namespace
|
|
':namespace' => $namespace
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ static function getRootNamespace($namespace) { // TODO: works only for relative urls! - mv to Acl->getRootNamespace
|
|
|
|
|
+ Lib::loadClass('SchemaFactory');
|
|
|
|
|
+ try {
|
|
|
|
|
+ $objectItem = SchemaFactory::loadDefaultObject('SystemObject')->getItem($namespace);
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ throw new Exception("Object not installed '{$namespace}'");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$objectItem['isStructInstalled']) throw new Exception("Object structure not installed '{$namespace}'");
|
|
|
|
|
+
|
|
|
|
|
+ if ($objectItem['idDatabase'] != DB::getPDO()->getZasobId()) {
|
|
|
|
|
+ if ('StorageAcl' === $objectItem['_type']) {
|
|
|
|
|
+ DBG::log("getRootNamespace...");
|
|
|
|
|
+ return $objectItem['namespace'];
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ throw new Exception("Only default_db supported"); // TODO: support more Sources
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return "default_db/{$objectItem['_rootTableName']}";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
static function getNamespaceSiblings($namespace) {
|
|
static function getNamespaceSiblings($namespace) {
|
|
|
return array_map(function ($row) {
|
|
return array_map(function ($row) {
|
|
|
return $row['namespace'];
|
|
return $row['namespace'];
|