|
|
@@ -12,13 +12,11 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
'@primaryKey' => 'idZasob',
|
|
|
'idZasob' => [ '@type' => 'xsd:integer' ],
|
|
|
'idDatabase' => [ '@type' => 'xsd:integer' ],
|
|
|
- 'nsPrefix' => [ '@type' => 'xsd:string' ],
|
|
|
- 'name' => [ '@type' => 'xsd:string' ],
|
|
|
+ 'namespace' => [ '@type' => 'xsd:string' ],
|
|
|
'_rootTableName' => [ '@type' => 'xsd:string' ],
|
|
|
'_type' => [ '@type' => 'xsd:string' ],
|
|
|
'isActive' => [ '@type' => 'xsd:integer' ], // installed
|
|
|
'description' => [ '@type' => 'xsd:string' ],
|
|
|
- 'namespace' => [ '@type' => 'xsd:string' ],
|
|
|
'reinstallLink' => [ '@type' => 'p5:www_link' ],
|
|
|
// 'A_RECORD_CREATE_AUTHOR' => [ '@type' => 'xsd:string' , '@label' => 'autor' ],
|
|
|
// 'A_RECORD_CREATE_DATE' => [ '@type' => 'xsd:date' , '@label' => 'utworzono' ],
|
|
|
@@ -101,19 +99,19 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
|
|
|
public function updateCache($idDatabase = null) {
|
|
|
DBG::simpleLog('schema', "SystemObject::updateCache...");
|
|
|
- DB::getPDO()->execSql(" drop table if exists `{$this->_rootTableName}` "); // TODO: DBG
|
|
|
+ // DB::getPDO()->execSql(" drop table if exists `{$this->_rootTableName}` "); // TODO: DBG
|
|
|
+ DB::getPDO()->execSql(" update `{$this->_rootTableName}` set isActive = 0 ");
|
|
|
DB::getPDO()->execSql("
|
|
|
create table if not exists `{$this->_rootTableName}` (
|
|
|
`idZasob` int(11) DEFAULT NULL,
|
|
|
`idDatabase` int(11) NOT NULL,
|
|
|
- `nsPrefix` varchar(255) DEFAULT '',
|
|
|
- `name` varchar(255) DEFAULT '',
|
|
|
+ `namespace` varchar(255) DEFAULT '',
|
|
|
`_rootTableName` varchar(255) DEFAULT '',
|
|
|
`_type` varchar(255) DEFAULT '',
|
|
|
`isActive` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'installed',
|
|
|
`description` varchar(255) DEFAULT '',
|
|
|
UNIQUE KEY `idZasob` (idZasob),
|
|
|
- UNIQUE KEY `typeName` (nsPrefix, name),
|
|
|
+ UNIQUE KEY `namespace` (namespace),
|
|
|
KEY `isActive` (isActive)
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin2
|
|
|
");
|
|
|
@@ -129,13 +127,12 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
$namespace = $acl->getNamespace();
|
|
|
$name = $acl->getName();
|
|
|
DB::getPDO()->execSql("
|
|
|
- insert ignore into `{$this->_rootTableName}` (nsPrefix, idDatabase, _type, name, description, isActive)
|
|
|
+ insert ignore into `{$this->_rootTableName}` (namespace, idDatabase, _type, description, isActive)
|
|
|
values (
|
|
|
- '{$source['nsPrefix']}'
|
|
|
+ '{$source['nsPrefix']}/{$name}'
|
|
|
, '{$source['idZasob']}'
|
|
|
, 'StorageAcl'
|
|
|
- , '{$name}'
|
|
|
- , ''
|
|
|
+ , '{$namespace}' -- test
|
|
|
, '1'
|
|
|
)
|
|
|
");
|
|
|
@@ -144,11 +141,10 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
}
|
|
|
}
|
|
|
DB::getPDO()->execSql("
|
|
|
- insert into `{$this->_rootTableName}` (idZasob, nsPrefix, idDatabase, name, description, isActive)
|
|
|
- select t.ID as idZasob
|
|
|
- , '{$source['nsPrefix']}' as nsPrefix
|
|
|
+ insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description, isActive)
|
|
|
+ select concat('{$source['nsPrefix']}/', t.`DESC`)
|
|
|
+ , t.ID as idZasob
|
|
|
, '{$source['idZasob']}' as idDatabase
|
|
|
- , t.`DESC` as name
|
|
|
, t.`OPIS` as description
|
|
|
, 1 as isActive
|
|
|
from CRM_LISTA_ZASOBOW t
|
|
|
@@ -168,10 +164,9 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
UI::alert('warning', "TODO: { id: {$source['idZasob']}, nsPrefix: '{$source['nsPrefix']}', dbName: '{$dbName}', dbType: '{$dbType}'} ...");
|
|
|
// TODO: if another DB split select and insert
|
|
|
DB::getPDO()->execSql("
|
|
|
- insert into `{$this->_rootTableName}` (idDatabase, nsPrefix, name, _rootTableName, _type, description)
|
|
|
- select '{$source['idZasob']}' as idDatabase
|
|
|
- , '{$source['nsPrefix']}' as nsPrefix
|
|
|
- , t.TABLE_NAME as name
|
|
|
+ insert into `{$this->_rootTableName}` (namespace, idDatabase, _rootTableName, _type, description)
|
|
|
+ select concat('{$source['nsPrefix']}/', t.TABLE_NAME) as namespace
|
|
|
+ , '{$source['idZasob']}' as idDatabase
|
|
|
, t.TABLE_NAME as _rootTableName
|
|
|
, 'TableAcl' as _type
|
|
|
, t.TABLE_COMMENT as description
|
|
|
@@ -180,13 +175,12 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
on duplicate key update _rootTableName = t.TABLE_NAME
|
|
|
");
|
|
|
DB::getPDO()->execSql("
|
|
|
- insert into `{$this->_rootTableName}` (idZasob, nsPrefix, idDatabase, name, description, isActive)
|
|
|
- select t.ID as idZasob
|
|
|
- , '{$source['nsPrefix']}' as nsPrefix
|
|
|
- , '{$source['idZasob']}' as idDatabase
|
|
|
- , t.`DESC` as name
|
|
|
- , t.`OPIS` as description
|
|
|
- , 1 as isActive
|
|
|
+ insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description, isActive)
|
|
|
+ select concat('{$source['nsPrefix']}/', t.`DESC`) as namespace
|
|
|
+ , t.ID as idZasob
|
|
|
+ , '{$source['idZasob']}' as idDatabase
|
|
|
+ , t.`OPIS` as description
|
|
|
+ , 1 as isActive
|
|
|
from CRM_LISTA_ZASOBOW t
|
|
|
where t.`TYPE` = 'TABELA'
|
|
|
and t.A_STATUS in('NORMAL', 'WAITING')
|
|
|
@@ -225,15 +219,13 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
// $namespace = $acl->getNamespace();
|
|
|
// $name = $acl->getName();
|
|
|
$idDatabase = DB::getPDO($sourceName)->getZasobId();
|
|
|
- $sqlNsPrefix = "{$sourceName}__x3A__{$rootTableName}";
|
|
|
- $sqlName = $name;
|
|
|
+ $sqlNamespace = "{$sourceName}/{$rootTableName}/{$name}";
|
|
|
DB::getPDO()->execSql("
|
|
|
- insert into `{$this->_rootTableName}` (nsPrefix, idDatabase, _type, name, description, isActive)
|
|
|
+ insert into `{$this->_rootTableName}` (namespace, idDatabase, _type, description, isActive)
|
|
|
values (
|
|
|
- '{$sqlNsPrefix}'
|
|
|
+ '{$sqlNamespace}'
|
|
|
, '{$idDatabase}'
|
|
|
, 'AntAcl'
|
|
|
- , '{$sqlName}'
|
|
|
, ''
|
|
|
, '1'
|
|
|
)
|
|
|
@@ -344,9 +336,7 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
}
|
|
|
|
|
|
public function buildFeatureFromSqlRow($item) {
|
|
|
- $namespace = str_replace('__x3A__', '/', $item['nsPrefix']) . '/' . $item['name'];
|
|
|
- $item['namespace'] = $namespace;
|
|
|
- $item['reinstallLink'] = Router::getRoute('Storage')->getLink('objectReinstall', [ 'namespace' => $namespace ]);
|
|
|
+ $item['reinstallLink'] = Router::getRoute('Storage')->getLink('objectReinstall', [ 'namespace' => $item['namespace'] ]);
|
|
|
return $item;
|
|
|
}
|
|
|
|