- private static $definition = [];
-
- /**
- * Loads the database structure definition from the static/dbview.config.php file.
- * On first pass, defines DB_UPDATE_VERSION constant.
- *
- * @see static/dbview.config.php
- * @param boolean $with_addons_structure Whether to tack on addons additional tables
- * @param string $basePath The base path of this application
- * @return array
- * @throws Exception
- */
- public static function definition($basePath = '', $with_addons_structure = true)
- {
- if (!self::$definition) {
- if (empty($basePath)) {
- $basePath = DI::app()->getBasePath();
- }
-
- $filename = $basePath . '/static/dbview.config.php';
-
- if (!is_readable($filename)) {
- throw new Exception('Missing database view config file static/dbview.config.php');
- }
-
- $definition = require $filename;
-
- if (!$definition) {
- throw new Exception('Corrupted database view config file static/dbview.config.php');
- }
-
- self::$definition = $definition;
- } else {
- $definition = self::$definition;
- }
-
- if ($with_addons_structure) {
- Hook::callAll('dbview_definition', $definition);
- }
-
- return $definition;
- }
-