-
- /**
- * Loads the database structure definition from the config/dbstructure.config.php file.
- * On first pass, defines DB_UPDATE_VERSION constant.
- *
- * @see config/dbstructure.config.php
- * @param boolean $with_addons_structure Whether to tack on addons additional tables
- * @return array
- * @throws Exception
- */
- public static function definition($with_addons_structure = true)
- {
- if (!self::$definition) {
- $a = \Friendica\BaseObject::getApp();
-
- $filename = $a->getBasePath() . '/config/dbstructure.config.php';
-
- if (!is_readable($filename)) {
- throw new Exception('Missing database structure config file config/dbstructure.config.php');
- }
-
- $definition = require $filename;
-
- if (!$definition) {
- throw new Exception('Corrupted database structure config file config/dbstructure.config.php');
- }
-
- self::$definition = $definition;
- } else {
- $definition = self::$definition;
- }
-
- if ($with_addons_structure) {
- Hook::callAll('dbstructure_definition', $definition);
- }
-
- return $definition;
- }