From: <tna...@us...> - 2007-05-26 17:11:21
|
Revision: 16461 http://svn.sourceforge.net/gallery/?rev=16461&view=rev Author: tnalmdal Date: 2007-05-26 10:11:23 -0700 (Sat, 26 May 2007) Log Message: ----------- Address issues related to r16457 (configureStore to create NEW tables is run BEFORE upgrade(), so we still may not have the new createSql column in time) Modified Paths: -------------- trunk/gallery2/modules/core/CoreModuleExtras.inc trunk/gallery2/modules/core/classes/GalleryStorage/GalleryStorageExtras.class Modified: trunk/gallery2/modules/core/CoreModuleExtras.inc =================================================================== --- trunk/gallery2/modules/core/CoreModuleExtras.inc 2007-05-26 14:53:58 UTC (rev 16460) +++ trunk/gallery2/modules/core/CoreModuleExtras.inc 2007-05-26 17:11:23 UTC (rev 16461) @@ -83,14 +83,6 @@ } } - if (!empty($currentVersion) && version_compare($currentVersion, '1.2.15', '<')) { - /* Add the createSql column to the schema table before it's used. */ - $ret = $storage->configureStore($module->getId(), array('Schema:1.0')); - if ($ret) { - return $ret; - } - } - /** * README: How to update the block below * @@ -2264,11 +2256,15 @@ case '1.2.14': /* * Add a new column to the Schema table to store the creation sql for each table. This - * change is to prepare the way for database export functionality. We have already done - * the configureStore above, so just populate the createSql column now. + * change is to prepare the way for database export functionality. */ $gallery->guaranteeTimeLimit(30); + $ret = $storage->configureStore($module->getId(), array('Schema:1.0')); + if ($ret) { + return $ret; + } + list ($ret, $modules) = GalleryCoreApi::fetchPluginStatus('module', true); if ($ret) { return $ret; Modified: trunk/gallery2/modules/core/classes/GalleryStorage/GalleryStorageExtras.class =================================================================== --- trunk/gallery2/modules/core/classes/GalleryStorage/GalleryStorageExtras.class 2007-05-26 14:53:58 UTC (rev 16460) +++ trunk/gallery2/modules/core/classes/GalleryStorage/GalleryStorageExtras.class 2007-05-26 17:11:23 UTC (rev 16461) @@ -1276,6 +1276,9 @@ if ($ret) { return $ret; } + + list ($major, $minor) = $tableVersions['Schema']; + $canStoreSql = version_compare("$major.$minor", '1.1', '>='); /* * Now take care of the rest of the tables. If the table doesn't exist, apply the current @@ -1292,9 +1295,11 @@ return $ret; } - $ret = $this->_updateSchemaCreateSql($tableNameInSchema, $sql); - if ($ret) { - return $ret; + if ($canStoreSql) { + $ret = $this->_updateSchemaCreateSql($tableNameInSchema, $sql); + if ($ret) { + return $ret; + } } } else { while (1) { @@ -1321,10 +1326,12 @@ return $ret; } - $ret = $this->_updateSchemaCreateSql($tableNameInSchema, + if ($canStoreSql) { + $ret = $this->_updateSchemaCreateSql($tableNameInSchema, $moduleSql['table'][$rawTableName]); - if ($ret) { - return $ret; + if ($ret) { + return $ret; + } } /* Remember altered tables for post-upgrade optimizations */ $altered = array($rawTableName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |