Index: branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php =================================================================== diff -u -r10666 -r10785 --- branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php (.../inportal_upgrade_v4.3.1.php) (revision 10666) +++ branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php (.../inportal_upgrade_v4.3.1.php) (revision 10785) @@ -15,4 +15,11 @@ if ($application->Conn->GetOne($sql) === false) { $application->Conn->Query($config_sql); } - } \ No newline at end of file + } + + require_once FULL_PATH . '/core/install/upgrades.php'; // k4_include_once doesn't globalize $upgrade_class :( + + $upgrade = new $upgrade_class(); + /* @var $upgrade CoreUpgrades */ + + $upgrade->Upgrade_4_3_1('after'); \ No newline at end of file Index: branches/RC/core/install/upgrades.php =================================================================== diff -u -r9986 -r10785 --- branches/RC/core/install/upgrades.php (.../upgrades.php) (revision 9986) +++ branches/RC/core/install/upgrades.php (.../upgrades.php) (revision 10785) @@ -164,9 +164,9 @@ */ function Upgrade_4_2_1($mode) { - + } - + function Upgrade_4_2_2($mode) { if ($mode == 'before') { @@ -175,6 +175,30 @@ } } + /** + * Adds index to "dob" field in "PortalUser" table when it's missing + * + * @param string $mode when called mode {before, after) + */ + function Upgrade_4_3_1($mode) + { + if ($mode == 'after') { + $sql = 'DESCRIBE ' . TABLE_PREFIX . 'PortalUser'; + $structure = $this->Conn->Query($sql); + + foreach ($structure as $field_info) { + if ($field_info['Field'] == 'dob') { + if (!$field_info['Key']) { + $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'PortalUser + ADD INDEX (dob)'; + $this->Conn->Query($sql); + } + break; + } + } + } + } + } ?> \ No newline at end of file