Index: branches/5.3.x/units/articles/articles_event_handler.php
===================================================================
--- branches/5.3.x/units/articles/articles_event_handler.php (revision 16107)
+++ branches/5.3.x/units/articles/articles_event_handler.php (revision 16108)
@@ -1,594 +1,594 @@
getObject();
/* @var $object kDBList */
if ( !$this->Application->isAdminUser ) {
$where_clause = '(Archived = 0) AND (StartDate < ' . time() . ' OR StartDate = 0) AND (EndOn > ' . time() . ' OR EndOn IS NULL)';
$object->addFilter('archived_filter', $where_clause);
}
}
/**
* Return type clauses for list bulding on front
*
* @param kEvent $event
* @return Array
*/
function getTypeClauses($event)
{
$type_clauses = parent::getTypeClauses($event);
$type_clauses['site_lead']['include']='%1$s.LeadStory = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['site_lead']['except']='%1$s.LeadStory <> 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['site_lead']['having_filter'] = false;
$type_clauses['cat_lead']['include']='%1$s.LeadCatStory = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['cat_lead']['except']='%1$s.LeadCatStory <> 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1';
$type_clauses['cat_lead']['having_filter'] = false;
return $type_clauses;
}
/**
* [CRON] Deletes expired articles + update existing articles from rss feed with new data (key - article url)
*
* @param kEvent $event
*/
function OnUpdateRSSArticles($event)
{
if ( defined('IS_INSTALL') && IS_INSTALL ) {
return;
}
$category_table = $this->Application->getUnitConfig('c')->getTableName();
$custom_table = $this->Application->getUnitConfig('c-cdata')->getTableName();
$category_custom_fields = $this->getCustomColumns('c');
$article_custom_fields = $this->getCustomColumns($event->Prefix);
// update categories which should be updated
$sql = 'SELECT cd.*, c.CategoryId
FROM '.$category_table.' c
LEFT JOIN '.$custom_table.' cd ON c.ResourceId = cd.ResourceId
WHERE (IF(cd.'.$category_custom_fields['RssLastUpdated'].' IS NULL, 0, cd.'.$category_custom_fields['RssLastUpdated'].') +
cd.'.$category_custom_fields['RssUpdateInterval'].' * cd.'.$category_custom_fields['RssUpdateIntervalType'].' <=
'.time().') AND (LENGTH('.$category_custom_fields['RssSource'].') > 0)';
$categories = $this->Conn->Query($sql, 'CategoryId');
if ($categories) {
$resource_ids = Array();
foreach ($categories as $category_id => $category_data) {
$resource_ids[] = $category_data['ResourceId'];
$event->setEventParam('source_url', $category_data[ $category_custom_fields['RssSource'] ]);
$event->setEventParam('category_id', $category_id);
$event->setEventParam('custom_fields', $article_custom_fields);
$event->setEventParam('life_time', $category_data[ $category_custom_fields['RssDefaultExpiration'] ] * $category_data[ $category_custom_fields['RssDefaultExpirationType'] ]);
$this->parseFeed($event);
}
$sql = 'UPDATE '.$custom_table.'
SET '.$category_custom_fields['RssLastUpdated'].' = '.time().'
WHERE ResourceId IN ('.implode(',', $resource_ids).')';
$this->Conn->Query($sql);
}
// delete expired articles from feed categories
$sql = 'SELECT c.CategoryId, c.ResourceId
FROM '.$category_table.' c
LEFT JOIN '.$custom_table.' cd ON c.ResourceId = cd.ResourceId
WHERE ( IF(cd.'.$category_custom_fields['RssLastExpired'].' IS NULL, 0, cd.'.$category_custom_fields['RssLastExpired'].') +
cd.'.$category_custom_fields['RssExpireInterval'].' * cd.'.$category_custom_fields['RssExpireIntervalType'].' <=
'.time().') AND (cd.'.$category_custom_fields['RssDeleteExpired'].' = 1)';
$categories = $this->Conn->GetCol($sql, 'ResourceId');
$config = $event->getUnitConfig();
$id_field = $config->getIDField();
$table = $config->getTableName();
$ci_table = $this->Application->getUnitConfig($event->Prefix . '-ci')->getTableName();
if ($categories) {
$article_custom_table = $this->Application->getUnitConfig($event->Prefix . '-cdata')->getTableName();
$sql = 'SELECT main_table.'.$id_field.'
FROM '.$table.' main_table
LEFT JOIN '.$ci_table.' ci ON main_table.ResourceId = ci.ItemResourceId
LEFT JOIN '.$article_custom_table.' cd ON main_table.ResourceId = cd.ResourceId
WHERE (ci.PrimaryCat = 1) AND
(ci.CategoryId IN ('.implode(',', $categories).')) AND
(main_table.EndOn < '.time().' AND main_table.EndOn IS NOT NULL) AND
(LENGTH(cd.'.$article_custom_fields['RssOriginalURL'].') > 0)';
$article_ids = $this->Conn->GetCol($sql);
if ($article_ids) {
$temp_handler = $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler', Array ('parent_event' => $event));
/* @var $temp_handler kTempTablesHandler */
$temp_handler->DeleteItems($event->Prefix, $event->Special, $article_ids);
}
$sql = 'UPDATE '.$custom_table.'
SET '.$category_custom_fields['RssLastExpired'].' = '.time().'
WHERE ResourceId IN ('.implode(',', array_keys($categories)).')';
$this->Conn->Query($sql);
}
}
/**
* Returns article ids & crc, that are created during feed import
*
* @param kEvent $event
* @return Array
*/
function getFeedArticles($event)
{
$config = $event->getUnitConfig();
$id_field = $config->getIDField();
$table = $config->getTableName();
$custom_table = $this->Application->getUnitConfig($event->Prefix . '-cdata')->getTableName();
$crc_field = $event->getEventParam('custom_fields', 'RssArticleCRC');
$sql = 'SELECT main_table.' . $id_field . ', cd.' . $crc_field . '
FROM ' . $table . ' main_table
LEFT JOIN ' . $custom_table . ' cd ON cd.ResourceId = main_table.ResourceId
WHERE LENGTH(cd.' . $crc_field . ') > 0';
return $this->Conn->GetCol($sql, $crc_field);
}
/**
* Creates new, updates existing articles from feed url specified
*
* @param kEvent $event
*/
function parseFeed($event)
{
$source_urls = explode(',', $event->getEventParam('source_url'));
if (count($source_urls) > 1) {
foreach ($source_urls as $source_url) {
$event->setEventParam('source_url', $source_url);
$this->parseFeed($event);
}
return true;
}
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$curl_helper->followLocation = true;
$curl_helper->setOptions( Array (CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)') ); // otherwise FeedBurner will return HTML
$xml_data = $curl_helper->Send($event->getEventParam('source_url'));
if (!$xml_data) {
return false;
}
$xml_helper = $this->Application->recallObject('kXMLHelper');
/* @var $xml_helper kXMLHelper */
$root_node =& $xml_helper->Parse($xml_data, kXMLHelper::XML_WITH_TEXT_NODES);
$feed_types = Array (
'rss_2.0' => 'channel', 'atom' => 'feed',
);
foreach ($feed_types as $feed_type => $node_name) {
$article_node =& $root_node->FindChild($node_name);
if (is_object($article_node)) {
break;
}
}
if (!$article_node) {
return false;
}
$category_id = $event->getEventParam('category_id');
$backup_category_id = $this->Application->GetVar('m_cat_id');
$this->Application->SetVar('m_cat_id', $category_id);
switch ($feed_type) {
case 'rss_2.0':
$this->parseRssFeed($article_node, $event);
break;
case 'atom':
$this->parseAtomFeed($article_node, $event);
break;
}
$this->Application->SetVar('m_cat_id', $backup_category_id);
}
/**
* Returns ML field names for article record
*
* @param kCatDBItem $object
* @return Array
*/
function _getMLFields(&$object)
{
$ml_formatter = $this->Application->recallObject('kMultiLanguage');
/* @var $ml_formatter kMultiLanguage */
$title_field = 'Title';
$title_formatter = $object->GetFieldOption($title_field, 'formatter');
if ( $title_formatter == 'kMultiLanguage' ) {
$title_field = $ml_formatter->LangFieldName($title_field);
}
$body_field = 'Body';
$body_formatter = $object->GetFieldOption($body_field, 'formatter');
if ( $body_formatter == 'kMultiLanguage' ) {
$body_field = $ml_formatter->LangFieldName($body_field);
}
return Array ($title_field, $body_field);
}
/**
* Parses RSS 2.0 feed
*
* @param kXMLNode $root_node
* @param kEvent $event
*/
function parseRssFeed(&$root_node, $event)
{
$current_node = $root_node->firstChild;
$feed_articles = $this->getFeedArticles($event);
$object = $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true));
/* @var $object kDBItem */
list ($title_field, $body_field) = $this->_getMLFields($object);
do {
// IMAGE is information about channel and is not useful here
if ($current_node->Name != 'ITEM') continue;
// collect item data
$data = Array();
$sub_node =& $current_node->firstChild;
/* @var $sub_node kXMLNode */
do {
if ($sub_node->Name == 'ATOM:SUMMARY') {
$data[$sub_node->Name] = $this->getNodeContent($sub_node);
} else {
$data[$sub_node->Name] = $this->getNodeContent($sub_node, 'xhtml'); // $sub_node->firstChild->Data; // was $sub_node->Data;
}
} while ( ($sub_node =& $sub_node->NextSibling()) );
// create/update article
$article_crc = kUtil::crc32($data['LINK'].$data['TITLE']);
$article_id = getArrayValue($feed_articles, $article_crc);
if ($article_id) {
$object->Load($article_id);
}
else {
$object->Clear();
}
$object->SetDBField($title_field, $data['TITLE']);
$object->SetDBField('cust_RssOriginalURL', $data['LINK']);
$object->SetDBField('cust_RssArticleCRC', $article_crc);
$object->SetDBField($body_field, !array_key_exists('DESCRIPTION', $data) ? $data['ATOM:SUMMARY'] : $data['DESCRIPTION']);
$expiration_time = time() + $event->getEventParam('life_time');
$object->SetDBField('EndOn_date', $expiration_time);
$object->SetDBField('EndOn_time', $expiration_time);
$object->SetDBField('Status', STATUS_ACTIVE);
$object->SetDBField('Author', 'root');
$object->SetDBField('CreatedById', USER_ROOT);
$status = $object->isLoaded() ? $object->Update() : $object->Create();
} while (($current_node =& $current_node->NextSibling()));
}
/**
* Returns parsed node content
*
* @param kXMLNode $node
* @param string $content_type
* @return string
*/
function getNodeContent(&$node, $content_type = null)
{
if ( !isset($content_type) ) {
$content_type = $node->GetAttribute('TYPE');
}
switch ($content_type) {
case 'xhtml':
$data = $node->GetXML(true);
break;
case 'html':
- $data = htmlspecialchars_decode( $node->GetXML(true) ); // $node->firstChild->Data // $node->Data
+ $data = kUtil::unescape($node->GetXML(true), kUtil::ESCAPE_HTML); // $node->firstChild->Data // $node->Data
break;
default:
$data = $node->GetXML(true); // $node->firstChild->Data; // $node->Data; also for 'text'
break;
}
return trim($data);
}
/**
* Parses ATOM feed
*
* @param kXMLNode $root_node
* @param kEvent $event
*/
function parseAtomFeed(&$root_node, $event)
{
$current_node = $root_node->firstChild;
$feed_articles = $this->getFeedArticles($event);
$object = $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true));
/* @var $object kDBItem */
list ($title_field, $body_field) = $this->_getMLFields($object);
do {
if ($current_node->Name != 'ENTRY') continue;
// collect item data
$data = Array();
$sub_node =& $current_node->firstChild;
/* @var $sub_node kXMLNode */
do {
if ($sub_node->Name == 'LINK') {
if ($sub_node->GetAttribute('REL') === false || $sub_node->GetAttribute('REL') == 'alternate') {
$data[$sub_node->Name] = $sub_node->GetAttribute('HREF');
}
}
elseif ($sub_node->Name == 'CONTENT' || $sub_node->Name == 'SUMMARY' || $sub_node->Name == 'TITLE') {
$data[$sub_node->Name] = $this->getNodeContent($sub_node);
}
else {
$data[$sub_node->Name] = $sub_node->GetXML(true); // firstChild->Data; // $sub_node->Data
}
} while ( ($sub_node =& $sub_node->NextSibling()) );
// create/update article
$article_crc = kUtil::crc32($data['LINK'].$data['TITLE']);
$article_id = getArrayValue($feed_articles, $article_crc);
if ($article_id) {
$object->Load($article_id);
}
else {
$object->Clear();
}
$object->SetDBField($title_field, $data['TITLE']);
$object->SetDBField('cust_RssOriginalURL', $data['LINK']);
$object->SetDBField('cust_RssArticleCRC', $article_crc);
$object->SetDBField($body_field, !array_key_exists('CONTENT', $data) ? $data['SUMMARY'] : $data['CONTENT']);
$expiration_time = time() + $event->getEventParam('life_time');
$object->SetDBField('EndOn_date', $expiration_time);
$object->SetDBField('EndOn_time', $expiration_time);
$object->SetDBField('Status', STATUS_ACTIVE);
$object->SetDBField('Author', 'root');
$object->SetDBField('CreatedById', USER_ROOT);
$status = $object->isLoaded() ? $object->Update() : $object->Create();
} while (($current_node =& $current_node->NextSibling()));
}
function getCustomColumns($prefix)
{
$ml_formatter = $this->Application->recallObject('kMultiLanguage');
/* @var $ml_formatter kMultiLanguage */
$custom_fields = array_flip($this->Application->getUnitConfig($prefix)->getCustomFields());
foreach ($custom_fields as $custom_name => $custom_id) {
$custom_fields[$custom_name] = $ml_formatter->LangFieldName('cust_' . $custom_id);
}
return $custom_fields;
}
/**
* Create missing excerpt
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
$this->createExcerpt($event);
$this->cacheItemOwner($event, 'CreatedById', 'Author');
}
/**
* Create missing excerpt
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$this->createExcerpt($event);
$this->cacheItemOwner($event, 'CreatedById', 'Author');
}
/**
* Create excerpt if missing
*
* @param kEvent $event
*/
function createExcerpt($event)
{
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$object->GetField('Excerpt') || $this->Application->GetVar('generate_excerpt') ) {
$excerpt = strip_tags($object->GetField('Body'));
$length = mb_strlen($excerpt);
if ( $length > 100 ) {
$excerpt = mb_substr(strip_tags($excerpt), 0, 100);
if ( mb_substr($excerpt, -1) != ' ' ) {
$pos = mb_strrpos($excerpt, ' ');
if ( $pos ) {
$excerpt = mb_substr($excerpt, 0, $pos);
}
}
$excerpt .= '...';
}
$excerpt_field = 'Excerpt';
$excerpt_formatter = $object->GetFieldOption('Excerpt', 'formatter');
if ( $excerpt_formatter == 'kMultiLanguage' ) {
$ml_formatter = $this->Application->recallObject('kMultiLanguage');
/* @var $ml_formatter kMultiLanguage */
$excerpt_field = $ml_formatter->LangFieldName($excerpt_field);
}
$object->SetDBField($excerpt_field, $excerpt);
}
}
/**
* [HOOK] Updates category custom fields options in config
*
* @param kEvent $event
*/
function OnUpdateCategoryCustomFields($event)
{
$this->Application->getUnitConfig('c')->addVirtualFields(Array (
'cust_RssSource' => Array ('type' => 'string', 'default' => ''),
'cust_RssDefaultExpiration' => Array ('type' => 'int', 'default' => ''),
'cust_RssDefaultExpirationType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month', 29030400 => 'la_opt_year'), 'use_phrases' => 1,
'default' => 60
),
'cust_RssExpireInterval' => Array ('type' => 'int', 'default' => ''),
'cust_RssExpireIntervalType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month'), 'use_phrases' => 1,
'default' => 60
),
'cust_RssDeleteExpired' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array (1 => 'la_Yes', 0 => 'la_No'),
'default' => 0
),
'cust_RssUpdateInterval' => Array ('type' => 'int', 'default' => ''),
'cust_RssUpdateIntervalType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month'), 'use_phrases' => 1,
'default' => 60
),
'cust_RssLastUpdated' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''),
'cust_RssLastExpired' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''),
));
}
/**
* Sets default expiration based on module setting
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnPreCreate(kEvent $event)
{
parent::OnPreCreate($event);
if ( $event->status != kEvent::erSUCCESS ) {
return ;
}
$object = $event->getObject();
/* @var $object kDBItem */
$archive_days = $this->Application->ConfigValue('News_Archive');
if ( $archive_days ) {
$expire_date = time() + $archive_days * 3600 * 24;
$object->SetDBField('EndOn_date', $expire_date);
$object->SetDBField('EndOn_time', $expire_date);
}
}
/**
* [HOOK] Allows to add cloned subitem to given prefix
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCloneSubItem(kEvent $event)
{
parent::OnCloneSubItem($event);
if ( $event->MasterEvent->Prefix == 'rev' ) {
$master_config = $event->MasterEvent->getUnitConfig();
$clones = $master_config->getClones('Clones', Array ());
$sub_item_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
$clones[$sub_item_prefix]['ConfigMapping'] = Array (
'PerPage' => 'Perpage_NewsReviews',
'ShortListPerPage' => 'Perpage_NewsReviews_Short',
'DefaultSorting1Field' => 'News_SortReviews',
'DefaultSorting2Field' => 'News_SortReviews2',
'DefaultSorting1Dir' => 'News_SortReviewsOrder',
'DefaultSorting2Dir' => 'News_SortReviewsOrder2',
'ReviewDelayInterval' => 'News_ReviewDelay_Interval',
'ReviewDelayValue' => 'News_ReviewDelay_Value',
);
$master_config->setClones($clones);
}
}
- }
\ No newline at end of file
+ }
Index: branches/5.3.x/admin_templates/user_item_tab.tpl
===================================================================
--- branches/5.3.x/admin_templates/user_item_tab.tpl (revision 16107)
+++ branches/5.3.x/admin_templates/user_item_tab.tpl (revision 16108)
@@ -1,43 +1,43 @@
" view_template="in-news/user_item_tab" edit_template="in-news/articles/articles_edit" dep_buttons="new_article" category_id="-1" class="catalog-tab">
$Catalog.setItemCount('', '');
- $Catalog.setCurrentCategory('', );
+ $Catalog.setCurrentCategory('', );
$Catalog.saveSearch('', '', '');
Grids[''].SetDependantToolbarButtons( new Array('edit','delete'));
$Catalog.setViewMenu('');
#separator#
-
\ No newline at end of file
+
Index: branches/5.3.x/admin_templates/catalog_tab.tpl
===================================================================
--- branches/5.3.x/admin_templates/catalog_tab.tpl (revision 16107)
+++ branches/5.3.x/admin_templates/catalog_tab.tpl (revision 16108)
@@ -1,64 +1,64 @@
a_toolbar.AddButton(
new ToolBarButton(
'in-news:new_article',
'',
add_item,
true
)
);
" view_template="in-news/catalog_tab" edit_template="in-news/articles/articles_edit" category_id="-1" dep_buttons="new_article" class="catalog-tab">
$Catalog.setItemCount('', '');
$Catalog.setItemCount('', '');
- $Catalog.setCurrentCategory('', );
+ $Catalog.setCurrentCategory('', );
$Catalog.saveSearch('', '', '');
Grids[''].AddAlternativeGrid('', true);
Grids[''].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
$Catalog.setViewMenu('');
Grids[''].DblClick = function() {return false};
#separator#
-
\ No newline at end of file
+
Index: branches/5.3.x/install/upgrades.php
===================================================================
--- branches/5.3.x/install/upgrades.php (revision 16107)
+++ branches/5.3.x/install/upgrades.php (revision 16108)
@@ -1,121 +1,122 @@
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-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'),
'5.3.0-B1' => Array ('Core' => '5.3.0-B1'),
);
}
/**
* 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') {
$categories_config = $this->Application->getUnitConfig('c');
$root_category = $this->Application->findModule('Name', 'In-News', 'RootCat');
$sql = 'UPDATE ' . $categories_config->getTableName() . '
SET UseMenuIconUrl = 1, MenuIconUrl = "in-news/img/menu_articles.gif"
WHERE ' . $categories_config->getIDField() . ' = ' . $root_category;
$this->Conn->Query($sql);
$this->_updateDetailTemplate('n', 'innews/detail', 'in-news/designs/detail');
}
}
/**
* 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) . '")';
$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_news.owner.modify", "la_event_news.owner.modify.pending")';
$this->Conn->Query($sql);
}
}
}
}
\ No newline at end of file
Index: branches/5.3.x/install/upgrades.sql
===================================================================
--- branches/5.3.x/install/upgrades.sql (revision 16107)
+++ branches/5.3.x/install/upgrades.sql (revision 16108)
@@ -1,151 +1,153 @@
# ===== 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 IN ('News_SortReviews', 'News_SortReviews2');
UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName IN ('News_SortReviewsOrder', '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 IN ('News_ReviewDelay_Interval', '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';
INSERT INTO Events VALUES(DEFAULT, 'NEWS.REVIEW.ADD.PENDING', NULL, 1, 0, NULL, 'In-News', 'la_event_article.review.add.pending', 1);
UPDATE ConfigurationAdmin SET ValueList = 'style="width: 50px;"' WHERE VariableName IN ('News_ReviewDelay_Value', 'News_RatingDelay_Value');
# ===== v 5.0.2-B1 =====
ALTER TABLE News
CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL,
CHANGE StartDate StartDate INT(11) NULL DEFAULT NULL,
CHANGE Modified Modified INT(11) NULL DEFAULT NULL;
# ===== v 5.0.2-B2 =====
# ===== v 5.0.2-RC1 =====
# ===== v 5.0.2 =====
# ===== v 5.0.3-B1 =====
# ===== 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-news/' WHERE `Name` = 'In-News';
DELETE FROM ConfigurationValues WHERE VariableName IN (
'Article_Root', 'News_PopCount', 'News_ArticleSort', 'News_CatSort', 'News_ShowMulti',
'News_Admin_Notice_New', 'News_Admin_Notice_Modify', 'News_Admin_Notice_Suggest',
'News_User_Notice_New', 'News_User_Notice_Approve', 'News_User_Notice_Deny',
'News_User_Notice_Modify', 'News_User_Notice_Modify_Approve', 'News_User_Notice_Modify_Deny'
);
DELETE FROM Permissions WHERE Permission LIKE 'in-news:configuration_email%';
# ===== v 5.1.0-RC1 =====
# ===== v 5.1.0 =====
# ===== v 5.1.1-B1 =====
ALTER TABLE News
CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL ,
CHANGE ModifiedById ModifiedById INT(11) NULL DEFAULT NULL;
# ===== v 5.1.1-RC1 =====
# ===== v 5.1.1 =====
# ===== v 5.1.2-B1 =====
# ===== v 5.1.2-RC1 =====
# ===== v 5.1.2 =====
# ===== v 5.1.3-B1 =====
# ===== v 5.1.3-RC1 =====
UPDATE ConfigurationValues
SET VariableValue = 'in-news/articles/article_detail'
WHERE VariableName = 'n_ItemTemplate' AND VariableValue = 'in-news/designs/detail';
# ===== v 5.1.3-RC2 =====
# ===== v 5.1.3 =====
UPDATE Phrase
SET `Module` = 'Core'
WHERE PhraseKey = 'LA_FLD_STARTDATE';
# ===== v 5.2.0-B1 =====
DELETE FROM SystemSettings
WHERE VariableName IN ('News_Highlight_OpenTag', 'News_Highlight_CloseTag');
# ===== v 5.2.0-B2 =====
UPDATE News main_table
SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>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-news:configuration_output.add', 11, 1, 1, 0);
# ===== v 5.2.1-B1 =====
UPDATE SystemSettings
SET DisplayOrder = 20.04
WHERE VariableName = 'Perpage_NewsReviews';
# ===== v 5.2.1-B2 =====
UPDATE Modules
SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InNews'
WHERE `Name` = 'In-News';
# ===== v 5.2.1-RC1 =====
+# ===== v 5.2.1 =====
+
# ===== v 5.3.0-B1 =====
Property changes on: branches/5.3.x
___________________________________________________________________
Modified: svn:mergeinfo
Merged /modules/in-news/branches/5.2.x:r15901-16071
Merged /modules/in-news/releases/5.2.1:r16072