|
|
@@ -23,6 +23,7 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
'maxOccurs' => [ '@type' => 'xsd:string' ], // '0..unbounded',
|
|
|
'isActive' => [ '@type' => 'xsd:integer' ], // installed
|
|
|
'description' => [ '@type' => 'xsd:string' ],
|
|
|
+ 'isLocal' => [ '@type' => 'xsd:integer', '@comment' => "is in _rootTableName" ],
|
|
|
// 'A_RECORD_CREATE_AUTHOR' => [ '@type' => 'xsd:string' , '@label' => 'autor' ],
|
|
|
// 'A_RECORD_CREATE_DATE' => [ '@type' => 'xsd:date' , '@label' => 'utworzono' ],
|
|
|
// 'A_RECORD_UPDATE_AUTHOR' => [ '@type' => 'xsd:string' , '@label' => 'zaktualizował' ],
|
|
|
@@ -51,6 +52,7 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
`maxOccurs` varchar(11) DEFAULT '1' COMMENT '0..unbounded',
|
|
|
`isActive` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'installed',
|
|
|
`description` varchar(255) DEFAULT '',
|
|
|
+ `isLocal` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is in _rootTableName',
|
|
|
UNIQUE KEY `idZasob` (idZasob),
|
|
|
PRIMARY KEY (`namespace`),
|
|
|
KEY `isActive` (isActive)
|
|
|
@@ -61,6 +63,11 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
} catch (Exception $e) {
|
|
|
DBG::log($e);
|
|
|
}
|
|
|
+ try {
|
|
|
+ DB::getPDO()->execSql(" ALTER TABLE `{$this->_rootTableName}` ADD `isLocal` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is in _rootTableName' AFTER `description` ");
|
|
|
+ } catch (Exception $e) {
|
|
|
+ DBG::log($e);
|
|
|
+ }
|
|
|
// DB::getPDO()->execSql(" drop table if exists `{$this->_rootTableName}_enum` ");// TODO: DBG
|
|
|
DB::getPDO()->execSql("
|
|
|
create table if not exists `{$this->_rootTableName}_enum` (
|
|
|
@@ -92,6 +99,21 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
// 'namespace' => $item['namespace'],
|
|
|
// 'isStructInstalled' => 1
|
|
|
// ]);
|
|
|
+ $dbName = DB::getPDO()->getDatabaseName();
|
|
|
+ DB::getPDO()->execSql("
|
|
|
+ update `{$this->_rootTableName}` t
|
|
|
+ set t.isLocal = IF(
|
|
|
+ ( select c.COLUMN_NAME
|
|
|
+ from information_schema.COLUMNS c
|
|
|
+ where c.COLUMN_NAME = t.fieldNamespace
|
|
|
+ and c.TABLE_SCHEMA = '{$dbName}'
|
|
|
+ and c.TABLE_NAME = '{$objectItem['_rootTableName']}'
|
|
|
+ limit 1
|
|
|
+ ) is null
|
|
|
+ , 0, 1)
|
|
|
+ where t.objectNamespace = '{$objectItem['namespace']}'
|
|
|
+ and t._rootTableName = '{$objectItem['_rootTableName']}'
|
|
|
+ ");
|
|
|
}
|
|
|
|
|
|
public function updateCacheAntAcl($item) {
|
|
|
@@ -99,51 +121,6 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
|
|
|
$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $item['typeName']);
|
|
|
if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
|
|
|
|
|
|
- // if (file_exists("{$antAclPath}/{$item['name']}.xsd")) {
|
|
|
- // DBG::log("{$antAclPath}/{$item['name']}.xsd", 'string', 'xsd file exists');
|
|
|
- // $outputType = 'XML';
|
|
|
- // $antOutput = file_get_contents("{$antAclPath}/{$item['name']}.xsd");
|
|
|
- // } else {
|
|
|
- // DBG::log($antAclPath, 'string', '$antAclPath');
|
|
|
- // $antBin = APP_PATH_WWW . DS . 'stuff' . DS . 'dita-ot-2.3.3' . DS . 'bin' . DS . 'ant';
|
|
|
- // $cmd = "cd {$antAclPath} && {$antBin} DescribeFeatureType 2>&1";
|
|
|
- // V::exec($cmd, $out, $ret);
|
|
|
- // DBG::log($out, 'array', "DescribeFeatureType ret({$ret})");
|
|
|
- // $outputType = 'XML';
|
|
|
- // $antOutput = []; $startRead = false;
|
|
|
- // foreach ($out as $line) {
|
|
|
- // // $line = " [echo] OUTPUT__TYPE__XML"
|
|
|
- // if ('[echo]' == substr(trim($line), 0, 6)) {
|
|
|
- // $line = trim(substr(trim($line), 7));
|
|
|
- // }
|
|
|
- //
|
|
|
- // if (!$startRead) {
|
|
|
- // if ('OUTPUT__TYPE__XML' == $line) $outputType = 'XML';
|
|
|
- // if ('OUTPUT__TYPE__HTML' == $line) $outputType = 'HTML';
|
|
|
- // if ('OUTPUT__START' == $line) {
|
|
|
- // $startRead = true;
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if ('<!DOCTYPE' == substr($line, 0, strlen('<!DOCTYPE'))) continue;
|
|
|
- // if ('OUTPUT__END' == $line) {
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // $antOutput[]= $line;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (!empty($antOutput)) $antOutput = implode("\n", $antOutput);
|
|
|
- // }
|
|
|
- // if (empty($antOutput)) UI::alert('danger', "Empty output!");
|
|
|
- // else {
|
|
|
- // echo UI::h('p', [], "Ant Schema:");
|
|
|
- // if ('XML' == $outputType) {
|
|
|
- // echo UI::h('pre', ['style' => 'max-height:400px; overflow:scroll'], htmlspecialchars($antOutput));
|
|
|
- // } else if ('HTML' == $outputType) {
|
|
|
- // echo UI::h('div', ['class'=>"container", 'style'=>"padding:12px; border:1px solid #ddd"], $antOutput);
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
Lib::loadClass('XML');
|
|
|
$schema = XML::readXmlFileToArray("{$antAclPath}/{$item['name']}.xsd");
|
|
|
if (empty($schema)) throw new Exception("Missing schema file for '{$item['namespace']}'");
|