Index: branches/5.2.x/install/upgrades.php =================================================================== --- branches/5.2.x/install/upgrades.php (revision 16068) +++ branches/5.2.x/install/upgrades.php (revision 16069) @@ -1,182 +1,183 @@ dependencies = Array ( '4.3.9' => Array ('Core' => '4.3.9'), '5.0.0' => Array ('Core' => '5.0.0'), '5.0.1' => Array ('Core' => '5.0.1'), '5.0.2-B1' => Array ('Core' => '5.0.2-B1'), '5.0.2-B2' => Array ('Core' => '5.0.2-B2'), '5.0.2-RC1' => Array ('Core' => '5.0.2-RC1'), '5.0.2' => Array ('Core' => '5.0.2'), '5.0.3-B1' => Array ('Core' => '5.0.3-B1'), '5.0.3-B2' => Array ('Core' => '5.0.3-B2'), '5.0.3-RC1' => Array ('Core' => '5.0.3-RC1'), '5.0.3' => Array ('Core' => '5.0.3'), '5.0.4-B1' => Array ('Core' => '5.0.4-B1'), '5.0.4-B2' => Array ('Core' => '5.0.4-B2'), '5.0.4' => Array ('Core' => '5.0.4'), '5.1.0-B1' => Array ('Core' => '5.1.0-B1'), '5.1.0-RC1' => Array ('Core' => '5.1.0-RC1'), '5.1.0' => Array ('Core' => '5.1.0'), '5.1.1-B1' => Array ('Core' => '5.1.1-B1'), '5.1.1-B2' => Array ('Core' => '5.1.1-B2'), '5.1.1-RC1' => Array ('Core' => '5.1.1-RC1'), '5.1.1' => Array ('Core' => '5.1.1'), '5.1.2-B1' => Array ('Core' => '5.1.2-B1'), '5.1.2-RC1' => Array ('Core' => '5.1.2-RC1'), '5.1.2' => Array ('Core' => '5.1.2'), '5.1.3-B1' => Array ('Core' => '5.1.3-B2'), '5.1.3-RC1' => Array ('Core' => '5.1.3-RC1'), '5.1.3-RC2' => Array ('Core' => '5.1.3-RC2'), '5.1.3' => Array ('Core' => '5.1.3'), '5.2.0-B1' => Array ('Core' => '5.2.0-B1'), '5.2.0-B2' => Array ('Core' => '5.2.0-B2'), '5.2.0-B3' => Array ('Core' => '5.2.0-B3'), '5.2.0-RC1' => Array ('Core' => '5.2.0-RC1'), '5.2.0' => Array ('Core' => '5.2.0'), '5.2.1-B1' => Array ('Core' => '5.2.1-B1'), '5.2.1-B2' => Array ('Core' => '5.2.1-B2'), '5.2.1-RC1' => Array ('Core' => '5.2.1-RC1'), + '5.2.1' => Array ('Core' => '5.2.1'), ); } /** * Changes table structure, where multilingual fields of TEXT type are present * * @param string $mode when called mode {before, after) */ function Upgrade_5_0_0($mode) { if ($mode == 'after') { $root_category = $this->Application->findModule('Name', 'In-Link', 'RootCat'); $sql = 'UPDATE ' . $this->Application->getUnitOption('c', 'TableName') . ' SET UseMenuIconUrl = 1, MenuIconUrl = "in-link/img/menu_links.gif" WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $root_category; $this->Conn->Query($sql); $this->_updateDetailTemplate('l', 'inlink/detail', 'in-link/designs/detail'); // copy link name and description to their multilingual equivalents $this->_copyToMultilingual(); } } /** * Copy link values from normal fields to multilingual * */ function _copyToMultilingual() { $fields = Array ('Name', 'Description'); $primary_language = $this->Application->GetDefaultLanguageId(); $set_clause = Array (); foreach ($fields as $field) { $set_clause[] = 'l' . $primary_language . '_' . $field . ' = ' . $field; } $sql = 'UPDATE ' . TABLE_PREFIX . 'Link SET ' . implode(', ', $set_clause); $this->Conn->Query($sql); } /** * Update to 5.0.1 * * @param string $mode when called mode {before, after) */ function Upgrade_5_0_1($mode) { if ($mode == 'after') { $this->_updateDetailTemplate('l', 'in-link/designs/detail', 'in-link/links/link_detail'); // delete old events $events_to_delete = Array ( 'LINK.OWNER.MODIFY.PENDING', 'LINK.OWNER.MODIFY' ); $sql = 'SELECT EventId FROM ' . TABLE_PREFIX . 'Events WHERE Event IN ("' . implode('","', $events_to_delete) . '")'; $event_ids = $this->Conn->GetCol($sql); if ($event_ids) { $sql = 'DELETE FROM ' . TABLE_PREFIX . 'EmailMessage WHERE EventId IN (' . implode(',', $event_ids) . ')'; $this->Conn->Query($sql); $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Events WHERE EventId IN (' . implode(',', $event_ids) . ')'; $this->Conn->Query($sql); $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Phrase WHERE Phrase IN ("la_event_link.owner.modify", "la_event_link.owner.modify.pending")'; $this->Conn->Query($sql); } } } /** * Update to 5.0.4-B1 * * @param string $mode when called mode {before, after) */ function Upgrade_5_0_4_B1($mode) { if ($mode == 'after') { // check in-link custom fields if need to add to search config $custom_fields = Array ( 'LinkAddress' => "('CustomField', 'LinkAddress', 1, 1, 'la_fld_LinkAddress', 'lu_fld_LinkAddress', 'In-Link', 'la_section_BusinessLocation', 1, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", 'LinkCity' => "('CustomField', 'LinkCity', 1, 1, 'la_fld_LinkCity', 'lu_fld_LinkCity', 'In-Link', 'la_section_BusinessLocation', 2, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", 'LinkState' => "('CustomField', 'LinkState', 1, 1, 'la_fld_LinkState', 'lu_fld_LinkState', 'In-Link', 'la_section_BusinessLocation', 3, DEFAULT, 0, 'select', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", 'LinkZipCode' => "('CustomField', 'LinkZipCode', 1, 1, 'la_fld_LinkZipCode', 'lu_fld_LinkZipCode', 'In-Link', 'la_section_BusinessLocation', 4, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", 'LinkCountry' => "('CustomField', 'LinkCountry', 1, 1, 'la_fld_LinkCountry', 'lu_fld_LinkCountry', 'In-Link', 'la_section_BusinessLocation', 5, DEFAULT, 0, 'select', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", 'LinkPhone' => "('CustomField', 'LinkPhone', 1, 1, 'la_fld_LinkPhone', 'lu_fld_LinkPhone', 'In-Link', 'la_section_BusinessLocation', 6, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, {CUSTOM_FIELD_ID})", ); // get all in-link custom fields ides at once $sql = 'SELECT CustomFieldId, FieldName FROM ' . TABLE_PREFIX . 'CustomField WHERE Type = 4 AND IsSystem = 0'; $custom_field_ids = $this->Conn->GetCol($sql, 'FieldName'); foreach ($custom_fields as $field_name => $custom_field_sql) { $sql = 'SELECT FieldName FROM ' . TABLE_PREFIX . 'SearchConfig WHERE (FieldName = ' . $this->Conn->qstr($field_name) . ') AND (LOWER(ModuleName) = "in-link")'; $found = $this->Conn->GetOne($sql); if (!$found) { // replace sql and insert new search config record $sql = str_replace('{CUSTOM_FIELD_ID}', $custom_field_ids[$field_name], $custom_field_sql); $sql = 'INSERT INTO ' . TABLE_PREFIX . 'SearchConfig VALUES ' . $sql; $this->Conn->Query($sql); } } } } - } \ No newline at end of file + } Index: branches/5.2.x/install/upgrades.sql =================================================================== --- branches/5.2.x/install/upgrades.sql (revision 16068) +++ branches/5.2.x/install/upgrades.sql (revision 16069) @@ -1,205 +1,207 @@ # ===== v 4.3.9 ===== INSERT INTO Events VALUES (DEFAULT, 'LINK.VALIDATION.RESULTS', NULL, 1, 0, 'In-Link', 'la_event_link.validation.results', 1); INSERT INTO ImportScripts VALUES (DEFAULT, 'Links from CSV file [In-Link]', '', 'l', 'In-Link', '', 'CSV', '1'); UPDATE CustomField SET ValueList = '=+||SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC' WHERE FieldName = 'LinkState'; UPDATE CustomField SET ValueList = '=+||SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC' WHERE FieldName = 'LinkCountry'; # ===== v 5.0.0 ===== INSERT INTO Counters VALUES (DEFAULT, 'linkhits_count', 'SELECT ROUND(SUM(Hits)) FROM <%PREFIX%>Link', NULL, NULL, '300', '0', '|Link|'); UPDATE Category SET Template = '/in-link/designs/section' WHERE Template = 'inlink/index'; UPDATE Category SET CachedTemplate = '/in-link/designs/section' WHERE CachedTemplate = 'inlink/index'; UPDATE ConfigurationValues SET VariableValue = '/in-link/designs/section' WHERE VariableName = 'l_CategoryTemplate'; UPDATE ConfigurationValues SET VariableValue = 'in-link/designs/detail' WHERE VariableName = 'l_ItemTemplate'; INSERT INTO Permissions VALUES (DEFAULT, 'in-link:links.view', 11, 1, 1, 0); INSERT INTO Permissions VALUES (DEFAULT, 'in-link:setting_folder.view', 11, 1, 1, 0); DELETE FROM Permissions WHERE Permission LIKE 'in-link:inlink_general.%'; UPDATE Events SET Description = 'la_event_link.owner.modify' WHERE Description = 'la_event_link.modify.modify'; UPDATE Events SET Description = 'la_event_link.owner.modify.pending' WHERE Description = 'la_event_link.modify.modify.pending'; UPDATE Phrase SET Module = 'In-Link' WHERE ((Phrase LIKE '%Links%' OR Phrase LIKE '%Listing%') AND (Module = 'Core') AND Phrase NOT IN ('la_section_QuickLinks')); UPDATE Phrase SET Module = 'In-Link', PhraseType = 1 WHERE ( (Phrase LIKE '%Validation%' OR Phrase LIKE 'la_title_In-Link') AND (Module = 'Core') AND Phrase NOT IN ('la_ValidationEmail', 'la_prompt_validation')); # ===== v 5.0.1 ===== UPDATE ConfigurationValues SET VariableValue = 'in-link/links/link_detail' WHERE VariableName = 'l_ItemTemplate'; UPDATE ConfigurationAdmin SET ValueList = 'ReviewText=la_opt_CommentText,CreatedOn=la_opt_CreatedOn' WHERE VariableName IN ('Link_ReviewsSort', 'Link_ReviewsSort2'); UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending' WHERE VariableName IN ('Link_ReviewsOrder', 'Link_ReviewsOrder2'); UPDATE ConfigurationAdmin SET ValueList = 'Name=la_Link_Name,Description=la_Link_Description,Url=la_Link_URL,CreatedOn=la_opt_CreatedOn,Hits=la_Link_Hits,CachedRating=la_opt_Rating,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 4) AND (IsSystem = 0)' WHERE VariableName IN ('Link_SortField', 'Link_SortField2'); UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year' WHERE VariableName IN ('link_ReviewDelay_Interval', 'link_RatingDelay_Interval'); UPDATE CustomField SET FieldLabel = 'la_fld_cust_l_ItemTemplate', Prompt = 'la_fld_cust_l_ItemTemplate' WHERE FieldName = 'l_ItemTemplate'; INSERT INTO Events VALUES(DEFAULT, 'LINK.REVIEW.ADD.PENDING', NULL, 1, 0, NULL, 'In-Link', 'la_event_link.review.add.pending', 1); UPDATE ConfigurationAdmin SET ValueList = 'style="width: 50px;"' WHERE VariableName IN ('link_ReviewDelay_Value', 'link_RatingDelay_Value'); # ===== v 5.0.2-B1 ===== ALTER TABLE ListingTypes CHANGE Description Description text NULL; ALTER TABLE LinkValidation CHANGE ValidationTime ValidationTime INT NULL DEFAULT NULL; ALTER TABLE LinkVisits CHANGE VisitTimestamp VisitTimestamp INT(11) NULL DEFAULT NULL; # ===== v 5.0.2-B2 ===== # ===== v 5.0.2-RC1 ===== # ===== v 5.0.2 ===== # ===== v 5.0.3-B1 ===== UPDATE Phrase SET Module = 'In-Link' WHERE Phrase IN ( 'lu_PermName_Link.Add.Pending_desc', 'lu_PermName_Link.Add_desc', 'lu_PermName_Link.Delete_desc', 'lu_PermName_Link.Modify.Pending_desc', 'lu_PermName_Link.Modify_desc', 'lu_PermName_Link.Owner.Delete_desc', 'lu_PermName_Link.Owner.Modify.Pending_desc', 'lu_PermName_Link.Owner.Modify_desc', 'lu_PermName_Link.Rate_desc', 'lu_PermName_Link.Review_Pending_desc', 'lu_PermName_Link.View_desc' ); # ===== v 5.0.3-B2 ===== # ===== v 5.0.3-RC1 ===== # ===== v 5.0.3 ===== # ===== v 5.0.4-B1 ===== # ===== v 5.0.4-B2 ===== # ===== v 5.0.4 ===== # ===== v 5.1.0-B1 ===== UPDATE Modules SET Path = 'modules/in-link/' WHERE `Name` = 'In-Link'; DELETE FROM ConfigurationValues WHERE VariableName IN ('StartValidationTime', 'LastExpirationTime', 'Link_Root'); UPDATE CustomField SET ValueList = '=+||SELECT IsoCode AS OptionValue, l%3$s_Name AS OptionName FROM CountryStates WHERE Type = 2 ORDER BY StateCountryId DESC, IsoCode ASC' WHERE ValueList = '=+||SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC'; UPDATE CustomField SET ValueList = '=+||SELECT IsoCode AS OptionValue, l%3$s_Name AS OptionName FROM CountryStates WHERE Type = 1 ORDER BY IsoCode ASC' WHERE ValueList = '=+||SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC'; DELETE FROM Permissions WHERE Permission LIKE 'in-link:configuration_email%'; # ===== v 5.1.0-RC1 ===== # ===== v 5.1.0 ===== # ===== v 5.1.1-B1 ===== ALTER TABLE Link CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL , CHANGE ModifiedById ModifiedById INT(11) NULL DEFAULT NULL; # ===== v 5.1.1-B2 ===== UPDATE Events SET l<%PRIMARY_LANGUAGE%>_Body = REPLACE(l<%PRIMARY_LANGUAGE%>_Body, 'CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId); # ===== v 5.2.0-B3 ===== # ===== v 5.2.0-RC1 ===== # ===== v 5.2.0 ===== INSERT INTO Permissions VALUES(DEFAULT, 'in-link:configuration_output.add', 11, 1, 1, 0); # ===== v 5.2.1-B1 ===== # ===== v 5.2.1-B2 ===== UPDATE Modules SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InLink' WHERE `Name` = 'In-Link'; # ===== v 5.2.1-RC1 ===== + +# ===== v 5.2.1 =====