فهرست منبع

fixed Storage parse inc configs

Piotr Labudda 8 سال پیش
والد
کامیت
e0f566bb9c
1فایلهای تغییر یافته به همراه30 افزوده شده و 0 حذف شده
  1. 30 0
      SE/se-lib/Schema/SystemSourceStorageAcl.php

+ 30 - 0
SE/se-lib/Schema/SystemSourceStorageAcl.php

@@ -50,6 +50,36 @@ class Schema_SystemSourceStorageAcl extends Core_AclSimpleSchemaBase {
 			}
 			return $line;
 		}
+		foreach (glob(APP_PATH_CONFIG . "/.cnf--zasob_*-{$host}.inc.php", GLOB_NOSORT) as $file) {
+			$fname = basename($file);
+			// DBG::nicePrint($fname, '$fname');
+			$idZasob = (int)substr($fname, strlen('.cnf--zasob_'), strpos($fname, '-', strlen('.cnf--zasob_') + 1) - strlen('.cnf--zasob_'));// '.cnf--zasob_931-...'
+			// DBG::nicePrint($idZasob, '$idZasob');
+			if (!$idZasob) continue;
+			{
+				$fun = include $file;
+				if (!is_callable($fun)) throw new Exception("Config func is not callable");
+				$conf = $fun('secret-p5-password');
+			}
+			if (!$conf) continue;
+			if (in_array(V::get('type', '', $conf), ['mysql', 'pgsql', 'mssql'])) {
+				DB::getPDO()->insertOrUpdate($this->_rootTableName, [
+					'idZasob' => $idZasob,
+					'nsPrefix' => "zasob_{$idZasob}",
+					'name' => V::get('database', $idZasob, $conf),
+					'hasConfig' => 1,
+					'@insert' => [
+						'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
+						'A_RECORD_CREATE_DATE' => 'NOW()',
+					],
+					'@update' => [
+						'A_RECORD_UPDATE_AUTHOR' => User::getLogin(),
+						'A_RECORD_UPDATE_DATE' => 'NOW()',
+					]
+				]);
+			}
+			// DBG::nicePrint(implode("\n", array_map( hideConfPass, explode("\n", var_export($conf, true)) ) ), '$conf');
+		}
 		foreach (glob(APP_PATH_CONFIG . "/.cnf--zasob_*-{$host}.ini.php", GLOB_NOSORT) as $file) {
 			$fname = basename($file);
 			// DBG::nicePrint($fname, '$fname');