Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1069301
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 19, 4:06 PM
Size
8 KB
Mime Type
text/x-diff
Expires
Mon, Jul 21, 4:06 PM (21 h, 24 m)
Engine
blob
Format
Raw Data
Handle
692228
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php
===================================================================
--- branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php (revision 10784)
+++ branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php (revision 10785)
@@ -1,18 +1,25 @@
<?php
$application =& kApplication::Instance();
$sqls = Array (
'CSVExportDelimiter' => "INSERT INTO " . TABLE_PREFIX . "ConfigurationValues VALUES (DEFAULT, 'CSVExportDelimiter', '0', 'In-Portal', 'in-portal:configure_general')",
'CSVExportEnclosure' => "INSERT INTO " . TABLE_PREFIX . "ConfigurationValues VALUES (DEFAULT, 'CSVExportEnclosure', '0', 'In-Portal', 'in-portal:configure_general')",
'CSVExportSeparator' => "INSERT INTO " . TABLE_PREFIX . "ConfigurationValues VALUES (DEFAULT, 'CSVExportSeparator', '0', 'In-Portal', 'in-portal:configure_general')",
'CSVExportEncoding' => "INSERT INTO " . TABLE_PREFIX . "ConfigurationValues VALUES (DEFAULT, 'CSVExportEncoding', '0', 'In-Portal', 'in-portal:configure_general')",
);
foreach ($sqls as $config_name => $config_sql) {
$sql = 'SELECT VariableId
FROM ' . TABLE_PREFIX . 'ConfigurationValues
WHERE VariableName = "' . $config_name . '"';
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
Property changes on: branches/RC/admin/install/upgrades/inportal_upgrade_v4.3.1.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.1
\ No newline at end of property
+1.1.2.2
\ No newline at end of property
Index: branches/RC/core/install/upgrades.php
===================================================================
--- branches/RC/core/install/upgrades.php (revision 10784)
+++ branches/RC/core/install/upgrades.php (revision 10785)
@@ -1,180 +1,204 @@
<?php
$upgrade_class = 'CoreUpgrades';
/**
* Class, that holds all upgrade scripts for "Core" module
*
*/
class CoreUpgrades extends kHelper {
/**
* Installator instance
*
* @var kInstallator
*/
var $Installator = null;
function setInstallator(&$instance)
{
$this->Installator =& $instance;
}
/**
* Changes table structure, where multilingual fields of TEXT type are present
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_4_1_0($mode)
{
if ($mode == 'before') {
// don't user after, because In-Portal calls this method too
$this->Installator->SaveConfig();
}
if ($mode == 'after') {
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
/* @var $ml_helper kMultiLanguageHelper */
$lang_count = $ml_helper->getLanguageCount();
$this->Application->UnitConfigReader->iterateConfigs(Array (&$this, 'updateTextFields'), $lang_count);
}
}
/**
* Moves ReplacementTags functionality from EmailMessage to Events table
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_4_1_1($mode)
{
if ($mode == 'after') {
$sql = 'SELECT ReplacementTags, EventId
FROM '.TABLE_PREFIX.'EmailMessage
WHERE (ReplacementTags IS NOT NULL) AND (ReplacementTags <> "") AND (LanguageId = 1)';
$replacement_tags = $this->Conn->GetCol($sql, 'EventId');
foreach ($replacement_tags as $event_id => $replacement_tag) {
$sql = 'UPDATE '.TABLE_PREFIX.'Events
SET ReplacementTags = '.$this->Conn->qstr($replacement_tag).'
WHERE EventId = '.$event_id;
$this->Conn->Query($sql);
}
// drop moved field from source table
$sql = 'ALTER TABLE '.TABLE_PREFIX.'EmailMessage
DROP `ReplacementTags`';
$this->Conn->Query($sql);
}
}
/**
* Callback function, that makes all ml fields of text type null with same default value
*
* @param string $prefix
* @param Array $config_data
* @param int $language_count
* @return bool
*/
function updateTextFields($prefix, &$config_data, $language_count)
{
if (!isset($config_data['TableName']) || !isset($config_data['Fields'])) {
// invalid config found or prefix not found
return false;
}
$table_name = $config_data['TableName'];
$table_structure = $this->Conn->Query('DESCRIBE '.$table_name, 'Field');
if (!$table_structure) {
// table not found
return false;
}
$sqls = Array ();
foreach ($config_data['Fields'] as $field => $options) {
if (isset($options['formatter']) && $options['formatter'] == 'kMultiLanguage' && !isset($options['master_field'])) {
// update all l<lang_id>_<field_name> fields (new format)
for ($i = 1; $i <= $language_count; $i++) {
$ml_field = 'l'.$i.'_'.$field;
if ($table_structure[$ml_field]['Type'] == 'text') {
$sqls[] = 'CHANGE '.$ml_field.' '.$ml_field.' TEXT NULL DEFAULT NULL';
}
}
// update <field_name> if found (old format)
if (isset($table_structure[$field]) && $table_structure[$field]['Type'] == 'text') {
$sqls[] = 'CHANGE '.$field.' '.$field.' TEXT NULL DEFAULT NULL';
}
}
}
if ($sqls) {
$sql = 'ALTER TABLE '.$table_name.' '.implode(', ', $sqls);
$this->Conn->Query($sql);
}
return true;
}
/**
* Replaces In-Portal tags in Forgot Password related email events to K4 ones
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_4_2_0($mode)
{
if ($mode == 'after') {
// 1. get event ids based on their name and type combination
$event_names = Array (
'USER.PSWD_'.EVENT_TYPE_ADMIN,
'USER.PSWD_'.EVENT_TYPE_FRONTEND,
'USER.PSWDC_'.EVENT_TYPE_FRONTEND,
);
$event_sql = Array ();
foreach ($event_names as $mixed_event) {
list ($event_name, $event_type) = explode('_', $mixed_event, 2);
$event_sql[] = 'Event = "'.$event_name.'" AND Type = '.$event_type;
}
$sql = 'SELECT EventId
FROM '.TABLE_PREFIX.'Events
WHERE ('.implode(') OR (', $event_sql).')';
$event_ids = implode(',', $this->Conn->GetCol($sql));
// 2. replace In-Portal tags to K4 tags
$replacements = Array (
'<inp:touser _Field="Password" />' => '<inp2:u_ForgottenPassword />',
'<inp:m_confirm_password_link />' => '<inp2:u_ConfirmPasswordLink no_amp="1"/>',
);
foreach ($replacements as $old_tag => $new_tag) {
$sql = 'UPDATE '.TABLE_PREFIX.'EmailMessage
SET Template = REPLACE(Template, '.$this->Conn->qstr($old_tag).', '.$this->Conn->qstr($new_tag).')
WHERE EventId IN ('.$event_ids.')';
$this->Conn->Query($sql);
}
}
}
/**
* Makes admin primary language same as front-end - not needed, done in SQL
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_4_2_1($mode)
{
-
+
}
-
+
function Upgrade_4_2_2($mode)
{
if ($mode == 'before') {
if ($this->Conn->GetOne('SELECT LanguageId FROM '.TABLE_PREFIX.'Language WHERE PrimaryLang = 1')) return ;
$this->Conn->Query('UPDATE '.TABLE_PREFIX.'Language SET PrimaryLang = 1 ORDER BY LanguageId LIMIT 1');
}
}
+ /**
+ * 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
Property changes on: branches/RC/core/install/upgrades.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7.2.5
\ No newline at end of property
+1.7.2.6
\ No newline at end of property
Event Timeline
Log In to Comment