X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fschemaupdater.php;h=38b5b93865255cc719875385f9e927c999da4abe;hb=15ab9ff9e3303255ff14166ee86ffdf3bc4f52ce;hp=1960a0693001c6948191dcf629b71c1bab38945e;hpb=12588b1cf73fad7d0a76a29a46ec355150eaa54e;p=quix0rs-gnu-social.git diff --git a/lib/schemaupdater.php b/lib/schemaupdater.php index 1960a06930..38b5b93865 100644 --- a/lib/schemaupdater.php +++ b/lib/schemaupdater.php @@ -28,9 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } class SchemaUpdater { @@ -46,6 +44,11 @@ class SchemaUpdater */ public function register($tableName, array $tableDef) { + // Check if the table we're registering is related to a Managed_DataObject + if (is_a(ucfirst($tableName), 'Managed_DataObject', true)) { + call_user_func("{$tableName}::beforeSchemaUpdate"); + } + $this->tables[$tableName] = $tableDef; } @@ -95,7 +98,6 @@ class SchemaUpdater { $checksums = array(); - PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION); try { $sv = new Schema_version(); $sv->find(); @@ -108,7 +110,6 @@ class SchemaUpdater // no dice! common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet."); } - PEAR::popErrorHandling(); return $checksums; } @@ -121,7 +122,6 @@ class SchemaUpdater */ protected function saveChecksum($table, $checksum) { - PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION); try { $sv = new Schema_version(); $sv->table_name = $table; @@ -136,7 +136,6 @@ class SchemaUpdater // no dice! common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet."); } - PEAR::popErrorHandling(); $this->checksums[$table] = $checksum; } }