Page MenuHomeIn-Portal Phabricator

in-news
No OneTemporary

File Metadata

Created
Sun, Feb 2, 8:36 PM
Index: branches/5.0.x/in-news/install/upgrades.php
===================================================================
--- branches/5.0.x/in-news/install/upgrades.php (revision 12432)
+++ branches/5.0.x/in-news/install/upgrades.php (revision 12433)
@@ -1,113 +1,118 @@
<?php
/**
* @version $Id$
* @package In-News
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.net/license/ for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$upgrade_class = 'InNewsUpgrades';
/**
* Class, that holds all upgrade scripts for "Core" module
*
*/
class InNewsUpgrades extends kHelper {
/**
* Install toolkit instance
*
* @var kInstallToolkit
*/
var $_toolkit = null;
/**
* Sets common instance of installator toolkit
*
* @param kInstallToolkit $instance
*/
function setToolkit(&$instance)
{
$this->_toolkit =& $instance;
}
/**
* 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-News', 'RootCat');
$sql = 'UPDATE ' . $this->Application->getUnitOption('c', 'TableName') . '
SET UseMenuIconUrl = 1, MenuIconUrl = "in-news/img/menu_articles.gif"
WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $root_category;
$this->Conn->Query($sql);
$this->_updateDetailTemplate('n', 'innews/detail', 'in-news/designs/detail');
}
}
/**
* Replaces deprecated detail template design with new one
*
* @param string $prefix
* @param string $from_template
* @param string $to_template
*/
function _updateDetailTemplate($prefix, $from_template, $to_template)
{
$sql = 'SELECT CustomFieldId
FROM ' . TABLE_PREFIX . 'CustomField
WHERE FieldName = "' . $prefix . '_ItemTemplate"';
$custom_field_id = $this->Conn->GetOne($sql);
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
/* @var $ml_formatter kMultiLanguage */
$field = $ml_formatter->LangFieldName('cust_' . $custom_field_id, true);
$sql = 'UPDATE ' . TABLE_PREFIX . 'CategoryCustomData
SET ' . $field . ' = "' . $to_template . '"
WHERE ' . $field . ' = "' . $from_template . '"';
$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('n', 'in-news/designs/detail', 'in-news/articles/article_detail');
// delete old events
- $events_to_delete = Array ( '"NEWS.OWNER.MODIFY.PENDING"', '"NEWS.OWNER.MODIFY"' );
- $sql = 'SELECT EventId
- FROM ' . TABLE_PREFIX . 'Events
- WHERE Event IN (' . implode(',', $events_to_delete) . ')';
+ $events_to_delete = Array ( 'NEWS.OWNER.MODIFY.PENDING', 'NEWS.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 EmailMessages WHERE EventId IN (' . implode(',', $event_ids) . ')';
+ $sql = 'DELETE FROM ' . TABLE_PREFIX . 'EmailMessage
+ WHERE EventId IN (' . implode(',', $event_ids) . ')';
$this->Conn->Query($sql);
- $sql = 'DELETE FROM Events WHERE EventId IN (' . implode(',', $event_ids) . ')';
+ $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_news.owner.modify", "la_event_news.owner.modify.pending")';
$this->Conn->Query($sql);
}
}
}
}
\ No newline at end of file
Index: branches/5.0.x/in-news/install/upgrades.sql
===================================================================
--- branches/5.0.x/in-news/install/upgrades.sql (revision 12432)
+++ branches/5.0.x/in-news/install/upgrades.sql (revision 12433)
@@ -1,53 +1,50 @@
# ===== v 4.3.9 =====
INSERT INTO ImportScripts VALUES (DEFAULT, 'Articles from CSV file [In-News]', '', 'n', 'In-News', '', 'CSV', '1');
# ===== v 5.0.0 =====
ALTER TABLE News ADD INDEX (StartDate), ADD INDEX (Archived);
UPDATE Category SET Template = '/in-news/designs/section' WHERE Template = 'innews/index';
UPDATE Category SET CachedTemplate = '/in-news/designs/section' WHERE CachedTemplate = 'innews/index';
UPDATE ConfigurationValues SET VariableValue = '/in-news/designs/section' WHERE VariableName = 'n_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-news/designs/detail' WHERE VariableName = 'n_ItemTemplate';
INSERT INTO Permissions VALUES (DEFAULT, 'in-news:articles.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-news:setting_folder.view', 11, 1, 1, 0);
DELETE FROM Permissions WHERE Permission LIKE 'in-news:innews_general.%';
UPDATE Phrase SET Module = 'In-News' WHERE ((Phrase LIKE '%Article%' OR Phrase LIKE '%News%') AND (Module = 'Core') AND Phrase NOT IN ('la_ToolTip_NewSearchConfig', 'la_tooltip_newstylesheet'));
UPDATE Phrase SET Module = 'In-News' WHERE Phrase = 'la_title_In-News';
# ===== v 5.0.1 =====
UPDATE ConfigurationValues SET VariableValue = 'in-news/articles/article_detail' WHERE VariableName = 'n_ItemTemplate';
UPDATE ConfigurationAdmin SET ValueList = 'ReviewText=la_opt_CommentText,CreatedOn=la_opt_CreatedOn'
WHERE VariableName = 'News_SortReviews';
UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName = 'News_SortReviewsOrder';
UPDATE ConfigurationAdmin SET ValueList = 'ReviewText=la_opt_CommentText,CreatedOn=la_opt_CreatedOn'
WHERE VariableName = 'News_SortReviews2';
UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName = 'News_SortReviewsOrder2';
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 = 'News_ReviewDelay_Interval';
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 = 'News_RatingDelay_Interval';
UPDATE CustomField SET FieldLabel = 'la_fld_RssSource', Prompt = 'la_fld_RssSource' WHERE FieldName = 'RssSource';
UPDATE CustomField SET FieldLabel = 'la_fld_RssDefaultExpiration', Prompt = 'la_fld_RssDefaultExpiration' WHERE FieldName = 'RssDefaultExpiration';
UPDATE CustomField SET FieldLabel = 'la_fld_RssUpdateInterval', Prompt = 'la_fld_RssUpdateInterval' WHERE FieldName = 'RssUpdateInterval';
UPDATE CustomField SET FieldLabel = 'la_fld_RssExpireInterval', Prompt = 'la_fld_RssExpireInterval' WHERE FieldName = 'RssExpireInterval';
UPDATE CustomField SET FieldLabel = 'la_fld_RssDeleteExpired', Prompt = 'la_fld_RssDeleteExpired' WHERE FieldName = 'RssDeleteExpired';
UPDATE CustomField SET FieldLabel = 'la_fld_RssLastExpired', Prompt = 'la_fld_RssLastExpired' WHERE FieldName = 'RssLastExpired';
UPDATE CustomField SET FieldLabel = 'la_fld_RssDefaultExpirationType', Prompt = 'la_fld_RssDefaultExpirationType' WHERE FieldName = 'RssDefaultExpirationType';
UPDATE CustomField SET FieldLabel = 'la_fld_RssExpireIntervalType', Prompt = 'la_fld_RssExpireIntervalType' WHERE FieldName = 'RssExpireIntervalType';
UPDATE CustomField SET FieldLabel = 'la_fld_RssUpdateIntervalType', Prompt = 'la_fld_RssUpdateIntervalType' WHERE FieldName = 'RssUpdateIntervalType';
UPDATE CustomField SET FieldLabel = 'la_fld_RssLastUpdated', Prompt = 'la_fld_RssLastUpdated' WHERE FieldName = 'RssLastUpdated';
UPDATE CustomField SET FieldLabel = 'la_fld_RssArticleCRC', Prompt = 'la_fld_RssArticleCRC' WHERE FieldName = 'RssArticleCRC';
UPDATE CustomField SET FieldLabel = 'la_fld_cust_n_ItemTemplate', Prompt = 'la_fld_cust_n_ItemTemplate' WHERE FieldName = 'n_ItemTemplate';
-
-DELETE FROM Events WHERE Event IN ('NEWS.OWNER.MODIFY.PENDING', 'NEWS.OWNER.MODIFY');
-DELETE FROM Phrase WHERE Phrase IN ('la_event_news.owner.modify', 'la_event_news.owner.modify.pending');

Event Timeline