|
@@ -86,6 +86,22 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Remove AntAcl with no struct (!hasStruct)
|
|
|
|
|
+ DB::getPDO()->execSql("
|
|
|
|
|
+ DELETE from `CRM_#CACHE_ACL_OBJECT`
|
|
|
|
|
+ where hasStruct = 0 and _type = 'AntAcl' and idZasob IS NULL
|
|
|
|
|
+ ");
|
|
|
|
|
+ // TODO: Fix AntAcl without struct but added to Zasoby
|
|
|
|
|
+ $toRemoveInstalledAntAcl = DB::getPDO()->fetchAll("
|
|
|
|
|
+ select *
|
|
|
|
|
+ from `CRM_#CACHE_ACL_OBJECT`
|
|
|
|
|
+ where hasStruct = 0 and _type = 'AntAcl' and idZasob IS NOT NULL
|
|
|
|
|
+ ");
|
|
|
|
|
+ DBG::nicePrint($toRemoveInstalledAntAcl, "to remove AntAcl added to Zasoby already but without xsd file");
|
|
|
|
|
+ foreach ($toRemoveInstalledAntAcl as $antAclToRmInfo) {
|
|
|
|
|
+ self::deleteObjectFromCache($antAclToRmInfo['idZasob'], $antAclToRmInfo['namespace']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Fix objects AntAcl which struct is not installed
|
|
// Fix objects AntAcl which struct is not installed
|
|
|
$listAntAclObjectsToFix = DB::getPDO()->fetchAll("
|
|
$listAntAclObjectsToFix = DB::getPDO()->fetchAll("
|
|
|
select t.*
|
|
select t.*
|
|
@@ -113,19 +129,14 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
{
|
|
{
|
|
|
Lib::loadClass('Schema_SystemObjectFieldStorageAcl');
|
|
Lib::loadClass('Schema_SystemObjectFieldStorageAcl');
|
|
|
|
|
|
|
|
- { // check if build.xml file still eixsts
|
|
|
|
|
- $item = [];
|
|
|
|
|
- $exNs = explode('/', $namespace);
|
|
|
|
|
- $item['name'] = array_pop($exNs);
|
|
|
|
|
- $item['nsPrefix'] = implode('__x3A__', $exNs);
|
|
|
|
|
- $item['typeName'] = implode('__x3A__', $exNs) . ':' . $item['name'];
|
|
|
|
|
-
|
|
|
|
|
- $antAclPath = Schema_SystemObjectFieldStorageAcl::getAntAclXsdBasePath($item['typeName']);
|
|
|
|
|
|
|
+ { // if build.xml file not exists then remove from Acl Cache (and Zasoby)
|
|
|
|
|
+ Lib::loadClass('Api_WfsNs');
|
|
|
|
|
+ $typeName = Api_WfsNs::toTypeName($namespace);
|
|
|
|
|
+ $antAclPath = Schema_SystemObjectFieldStorageAcl::getAntAclXsdBasePath($typeName);
|
|
|
if (!file_exists("{$antAclPath}/build.xml")) {
|
|
if (!file_exists("{$antAclPath}/build.xml")) {
|
|
|
UI::alert('danger', "Ant build file not exists for namespace '{$antAclInfo['namespace']}' - Removing AntAcl");
|
|
UI::alert('danger', "Ant build file not exists for namespace '{$antAclInfo['namespace']}' - Removing AntAcl");
|
|
|
- Schema_SystemObjectStorageAcl::deleteObjectFromCache($antAclInfo['idZasob'], $antAclInfo['namespace']);
|
|
|
|
|
-
|
|
|
|
|
- // throw new Exception("Ant build file not exists #TEST_OFF");
|
|
|
|
|
|
|
+ self::deleteObjectFromCache($antAclInfo['idZasob'], $antAclInfo['namespace']);
|
|
|
|
|
+ ob_get_clean();
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -135,11 +146,12 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
$objFieldAcl->updateCache($namespace);
|
|
$objFieldAcl->updateCache($namespace);
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
UI::alert('danger', $e->getMessage());
|
|
UI::alert('danger', $e->getMessage());
|
|
|
- Schema_SystemObjectStorageAcl::deleteObjectFromCache($antAclInfo['idZasob'], $antAclInfo['namespace']);
|
|
|
|
|
|
|
+ self::deleteObjectFromCache($antAclInfo['idZasob'], $antAclInfo['namespace']);
|
|
|
|
|
+ ob_get_clean();
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- $reinstallLog = ob_get_clean();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $reinstallLog = ob_get_clean();
|
|
|
// DBG::nicePrint($reinstallLog, "\$reinstallLog ({$namespace})");
|
|
// DBG::nicePrint($reinstallLog, "\$reinstallLog ({$namespace})");
|
|
|
|
|
|
|
|
$fieldCacheStruct = DB::getPDO()->fetchAll("
|
|
$fieldCacheStruct = DB::getPDO()->fetchAll("
|
|
@@ -221,7 +233,7 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
}
|
|
}
|
|
|
DB::getPDO()->execSql("
|
|
DB::getPDO()->execSql("
|
|
|
insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description, hasStruct)
|
|
insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description, hasStruct)
|
|
|
- select concat('{$source['nsPrefix']}/', t.`DESC`)
|
|
|
|
|
|
|
+ select concat('default_objects/', t.`DESC`)
|
|
|
, t.ID as idZasob
|
|
, t.ID as idZasob
|
|
|
, '{$idSource}' as idDatabase
|
|
, '{$idSource}' as idDatabase
|
|
|
, t.`OPIS` as description
|
|
, t.`OPIS` as description
|
|
@@ -257,26 +269,28 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
from INFORMATION_SCHEMA.TABLES t
|
|
from INFORMATION_SCHEMA.TABLES t
|
|
|
where t.TABLE_SCHEMA = '{$dbName}'
|
|
where t.TABLE_SCHEMA = '{$dbName}'
|
|
|
and t.TABLE_NAME not like '%#%'
|
|
and t.TABLE_NAME not like '%#%'
|
|
|
|
|
+ and t.TABLE_NAME not like '%@%'
|
|
|
on duplicate key update _rootTableName = t.TABLE_NAME
|
|
on duplicate key update _rootTableName = t.TABLE_NAME
|
|
|
, hasStruct = 1
|
|
, hasStruct = 1
|
|
|
, isStructInstalled = 1
|
|
, isStructInstalled = 1
|
|
|
");
|
|
");
|
|
|
|
|
+
|
|
|
|
|
+ // Insert to Cache from Zasoby
|
|
|
|
|
+ // NOTE: hasStruct cannot be set bc struct may not exists
|
|
|
DB::getPDO()->execSql("
|
|
DB::getPDO()->execSql("
|
|
|
- insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description, hasStruct)
|
|
|
|
|
- select IF(t.`DESC` like 'default_db/%',
|
|
|
|
|
|
|
+ insert into `{$this->_rootTableName}` (namespace, idZasob, idDatabase, description)
|
|
|
|
|
+ select IF(t.`DESC` like '{$source['nsPrefix']}/%',
|
|
|
t.`DESC`,
|
|
t.`DESC`,
|
|
|
concat('{$source['nsPrefix']}/', t.`DESC`)
|
|
concat('{$source['nsPrefix']}/', t.`DESC`)
|
|
|
) as namespace
|
|
) as namespace
|
|
|
, t.ID as idZasob
|
|
, t.ID as idZasob
|
|
|
, '{$source['idZasob']}' as idDatabase
|
|
, '{$source['idZasob']}' as idDatabase
|
|
|
, t.`OPIS` as description
|
|
, t.`OPIS` as description
|
|
|
- , 1 as hasStruct
|
|
|
|
|
from CRM_LISTA_ZASOBOW t
|
|
from CRM_LISTA_ZASOBOW t
|
|
|
where t.`TYPE` = 'TABELA'
|
|
where t.`TYPE` = 'TABELA'
|
|
|
and t.A_STATUS in('NORMAL', 'WAITING')
|
|
and t.A_STATUS in('NORMAL', 'WAITING')
|
|
|
and t.PARENT_ID = {$source['idZasob']}
|
|
and t.PARENT_ID = {$source['idZasob']}
|
|
|
on duplicate key update idZasob = t.ID
|
|
on duplicate key update idZasob = t.ID
|
|
|
- , hasStruct = 1
|
|
|
|
|
");
|
|
");
|
|
|
}
|
|
}
|
|
|
function _updateAntObjectCache($buildXmlPath, $basePath) {
|
|
function _updateAntObjectCache($buildXmlPath, $basePath) {
|
|
@@ -486,8 +500,13 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
", [
|
|
", [
|
|
|
':namespace' => $namespace,
|
|
':namespace' => $namespace,
|
|
|
]);
|
|
]);
|
|
|
|
|
+ DB::getPDO()->insert('CRM_LISTA_ZASOBOW_HIST', [
|
|
|
|
|
+ 'ID_USERS2' => $idZasob,
|
|
|
|
|
+ 'A_STATUS' => "DELETED",
|
|
|
|
|
+ 'A_RECORD_UPDATE_AUTHOR' => "update-acl-cache",
|
|
|
|
|
+ 'A_RECORD_UPDATE_DATE' => "NOW()",
|
|
|
|
|
+ ]);
|
|
|
DB::getPDO()->update('CRM_LISTA_ZASOBOW', 'ID', $idZasob, [
|
|
DB::getPDO()->update('CRM_LISTA_ZASOBOW', 'ID', $idZasob, [
|
|
|
- 'PARENT_ID' => -1,
|
|
|
|
|
'A_STATUS' => "DELETED",
|
|
'A_STATUS' => "DELETED",
|
|
|
'A_RECORD_UPDATE_AUTHOR' => "update-acl-cache",
|
|
'A_RECORD_UPDATE_AUTHOR' => "update-acl-cache",
|
|
|
'A_RECORD_UPDATE_DATE' => "NOW()",
|
|
'A_RECORD_UPDATE_DATE' => "NOW()",
|