Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726909
in-news
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
Mon, Jan 6, 3:10 AM
Size
4 KB
Mime Type
text/x-diff
Expires
Wed, Jan 8, 3:10 AM (1 d, 19 h ago)
Engine
blob
Format
Raw Data
Handle
536995
Attached To
rMINN Modules.In-News
in-news
View Options
Index: branches/5.1.x/install/upgrades.php
===================================================================
--- branches/5.1.x/install/upgrades.php (revision 14456)
+++ branches/5.1.x/install/upgrades.php (revision 14457)
@@ -1,133 +1,134 @@
<?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.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$upgrade_class = 'InNewsUpgrades';
/**
* Class, that holds all upgrade scripts for "In-News" module
*
*/
class InNewsUpgrades extends kUpgradeHelper {
function InNewsUpgrades()
{
parent::kHelper();
$this->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'),
);
}
/**
* 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) . '")';
$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
Event Timeline
Log In to Comment