Просмотр исходного кода

fixed storage ant acl reinstall for project based schema

Piotr Labudda 8 лет назад
Родитель
Сommit
39ea9b14f5
2 измененных файлов с 16 добавлено и 2 удалено
  1. 2 1
      SE/se-lib/Route/Storage/AclReinstall.php
  2. 14 1
      SE/se-lib/Schema/SystemObjectFieldStorageAcl.php

+ 2 - 1
SE/se-lib/Route/Storage/AclReinstall.php

@@ -139,7 +139,8 @@ class Route_Storage_AclReinstall extends RouteBase {
 		}
 		}
 	}
 	}
 	public function printReinstallAntAclPreview($item) {
 	public function printReinstallAntAclPreview($item) {
-		$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $item['typeName']);
+		Lib::loadClass('Schema_SystemObjectFieldStorageAcl');
+		$antAclPath = Schema_SystemObjectFieldStorageAcl::getAntAclXsdBasePath($item['typeName']);
 		if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
 		if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
 
 
 		Lib::loadClass('XML');
 		Lib::loadClass('XML');

+ 14 - 1
SE/se-lib/Schema/SystemObjectFieldStorageAcl.php

@@ -34,6 +34,19 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
 	public $_rootTableName = 'CRM_#CACHE_ACL_OBJECT_FIELD';
 	public $_rootTableName = 'CRM_#CACHE_ACL_OBJECT_FIELD';
 	public $_version = '1';
 	public $_version = '1';
 
 
+	public static function getAntAclXsdBasePath($typeName) {
+		$antAclPath = null;
+		if ($activeProject = Config::getProjectPath()) {
+			$tryProjectSchemaPath = "{$activeProject}/schema/ant-object/" . str_replace(['__x3A__', ':'], ['.', '/'], $typeName);
+			if (file_exists($tryProjectSchemaPath)) {
+				$antAclPath = $tryProjectSchemaPath;
+			}
+		}
+		if (!$antAclPath) {
+			$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $typeName);
+		}
+		return $antAclPath;
+	}
 	public function updateCache($namespace = null) {
 	public function updateCache($namespace = null) {
 		DBG::log("SystemObjectField::updateCache({$namespace})...");
 		DBG::log("SystemObjectField::updateCache({$namespace})...");
 		DB::getPDO()->execSql("
 		DB::getPDO()->execSql("
@@ -120,7 +133,7 @@ class Schema_SystemObjectFieldStorageAcl extends Core_AclSimpleSchemaBase {
 
 
 	public function updateCacheAntAcl($item) {
 	public function updateCacheAntAcl($item) {
 		Lib::loadClass('AntAclBase');
 		Lib::loadClass('AntAclBase');
-		$antAclPath = APP_PATH_SCHEMA . DS . 'ant-object' . DS . str_replace(['__x3A__', ':'], ['.', '/'], $item['typeName']);
+		$antAclPath = Schema_SystemObjectFieldStorageAcl::getAntAclXsdBasePath($item['typeName']);
 		if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
 		if (!file_exists("{$antAclPath}/build.xml")) throw new Exception("Ant build file not exists");
 
 
 		Lib::loadClass('XML');
 		Lib::loadClass('XML');