Version 4.0.13.1
This commit is contained in:
1 parent
f9e857d255
commit
c6a86f0d9b
7517 files changed
+597400
-668041
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_allowlocal",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can create blogs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_maxblogs",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Maximum number of blogs",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_allowprivate",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can create private blogs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_allowownmod",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can moderate own blogs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_allowdelete",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can delete own blogs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "g_blog_allowcomment",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can comment on blogs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_name_seo",
|
||||
{
|
||||
"allow_null": true,
|
||||
"auto_increment": false,
|
||||
"binary": false,
|
||||
"comment": "",
|
||||
"decimals": null,
|
||||
"default": null,
|
||||
"length": 255,
|
||||
"name": "entry_name_seo",
|
||||
"type": "VARCHAR",
|
||||
"unsigned": false,
|
||||
"values": [],
|
||||
"zerofill": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 30 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100002;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Fix SEO titles
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\Db::i()->update( 'blog_blogs', array( 'blog_seo_name' => NULL ) );
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_name_seo' => NULL ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Resetting blog friendly URL titles";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix Polls
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step2()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? intval( \IPS\Request::i()->extra ) : 0;
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', 'blog_polls', NULL, 'poll_id ASC', array( $limit, 1000 ) );
|
||||
|
||||
if ( !$select->count() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
foreach ( $select as $poll )
|
||||
{
|
||||
/* Sometimes data from 3.4.x isn't always as well formed as we'd like, especially when non-latin chars are involved */
|
||||
$data = unserialize( $poll['choices'] );
|
||||
|
||||
if( !is_array( $data ) )
|
||||
{
|
||||
$poll['choices'] = str_replace( '\\"', '"', $poll['choices'] );
|
||||
$data = unserialize( $poll['choices'] );
|
||||
}
|
||||
|
||||
$_decoded = FALSE;
|
||||
|
||||
if( !is_array( $data ) )
|
||||
{
|
||||
$data = unserialize( utf8_decode( $poll['choices'] ) );
|
||||
|
||||
if( is_array( $data ) )
|
||||
{
|
||||
$_decoded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array( $data ) AND $_decoded )
|
||||
{
|
||||
foreach( $data as $_key => $_data )
|
||||
{
|
||||
$data[ $_key ]['question'] = utf8_encode( $_data[ $_key ]['question'] );
|
||||
|
||||
if( is_array( $_data['choice'] ) )
|
||||
{
|
||||
foreach( $_data['choice'] as $_idx => $_choice )
|
||||
{
|
||||
$data[ $_key ]['choice'][ $_idx ] = utf8_encode( $_choice );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = @json_encode( $data );
|
||||
|
||||
/* @link http://community.invisionpower.com/4bugtrack/beta-8-json_encode-invalid-utf-8-sequence-in-argument-during-upgrade-from-347-r2636/
|
||||
Sometimes the array unserializes fine but there are still "bad" characters in there */
|
||||
if( $result === FALSE )
|
||||
{
|
||||
$data = unserialize( $poll['choices'] );
|
||||
|
||||
if( !is_array( $data ) )
|
||||
{
|
||||
$poll['choices'] = str_replace( '\\"', '"', $poll['choices'] );
|
||||
$data = unserialize( $poll['choices'] );
|
||||
}
|
||||
|
||||
if( !is_array( $data ) )
|
||||
{
|
||||
$data = unserialize( utf8_decode( $poll['choices'] ) );
|
||||
}
|
||||
|
||||
if( is_array( $data ) )
|
||||
{
|
||||
foreach( $data as $_key => $_data )
|
||||
{
|
||||
$data[ $_key ]['question'] = utf8_encode( $_data['question'] );
|
||||
|
||||
if( is_array( $_data['choice'] ) )
|
||||
{
|
||||
foreach( $_data['choice'] as $_idx => $_choice )
|
||||
{
|
||||
$data[ $_key ]['choice'][ $_idx ] = utf8_encode( $_choice );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No choices, no poll */
|
||||
\IPS\Db::i()->delete( 'core_polls', array( 'pid=?', $poll['pid'] ) );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = @json_encode( $data );
|
||||
}
|
||||
|
||||
unset( $poll['poll_id'] );
|
||||
$poll['choices'] = $result;
|
||||
$poll['tid'] = 0;
|
||||
$poll['forum_id'] = 0;
|
||||
$poll['poll_only'] = 0;
|
||||
$poll['poll_view_voters'] = 0;
|
||||
|
||||
$entryId = $poll['entry_id'];
|
||||
unset( $poll['entry_id'] );
|
||||
|
||||
$pollId = \IPS\Db::i()->insert( 'core_polls', $poll );
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_poll_state' => $pollId ), array( 'entry_id=?', $entryId ) );
|
||||
}
|
||||
|
||||
return $limit + 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Upgrading polls...";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix Voters
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step3()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? intval( \IPS\Request::i()->extra ) : 0;
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', 'blog_voters', NULL, 'vote_id ASC', array( $limit, 1000 ) );
|
||||
|
||||
if ( !$select->count() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
foreach ( $select as $vote )
|
||||
{
|
||||
try
|
||||
{
|
||||
$pollId = \IPS\Db::i()->select( 'entry_poll_state', 'blog_entries', array( 'entry_id=?', $vote['entry_id'] ) )->first();
|
||||
|
||||
unset( $vote['vote_id'] );
|
||||
unset( $vote['entry_id'] );
|
||||
$vote['member_choices'] = null;
|
||||
$vote['poll'] = $pollId;
|
||||
|
||||
\IPS\Db::i()->insert( 'core_voters', $vote );
|
||||
}
|
||||
catch( \UnderflowException $ex ) { }
|
||||
}
|
||||
|
||||
return $limit + 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Upgrading polls...";
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,205 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"comment_text"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_name"
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_content"
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_akismet_logs",
|
||||
true
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_bookmarks",
|
||||
true
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_categories",
|
||||
true
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_category_mapping",
|
||||
true
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_cblock_cache",
|
||||
true
|
||||
]
|
||||
},
|
||||
"9": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_cblocks",
|
||||
true
|
||||
]
|
||||
},
|
||||
"10": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_custom_cblocks",
|
||||
true
|
||||
]
|
||||
},
|
||||
"11": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_default_cblocks",
|
||||
true
|
||||
]
|
||||
},
|
||||
"12": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_editors_map",
|
||||
true
|
||||
]
|
||||
},
|
||||
"13": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_lastinfo",
|
||||
true
|
||||
]
|
||||
},
|
||||
"14": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_mediatag",
|
||||
true
|
||||
]
|
||||
},
|
||||
"15": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_moderators",
|
||||
true
|
||||
]
|
||||
},
|
||||
"16": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_pingservices",
|
||||
true
|
||||
]
|
||||
},
|
||||
"17": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_polls",
|
||||
true
|
||||
]
|
||||
},
|
||||
"18": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_ratings",
|
||||
true
|
||||
]
|
||||
},
|
||||
"19": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_rsscache",
|
||||
true
|
||||
]
|
||||
},
|
||||
"20": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_themes",
|
||||
true
|
||||
]
|
||||
},
|
||||
"21": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_this",
|
||||
true
|
||||
]
|
||||
},
|
||||
"22": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_trackback",
|
||||
true
|
||||
]
|
||||
},
|
||||
"23": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_trackback_spamlogs",
|
||||
true
|
||||
]
|
||||
},
|
||||
"24": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_tracker",
|
||||
true
|
||||
]
|
||||
},
|
||||
"25": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_tracker_queue",
|
||||
true
|
||||
]
|
||||
},
|
||||
"26": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_updatepings",
|
||||
true
|
||||
]
|
||||
},
|
||||
"27": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_upgrade_history",
|
||||
true
|
||||
]
|
||||
},
|
||||
"28": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_views",
|
||||
true
|
||||
]
|
||||
},
|
||||
"29": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"blog_voters",
|
||||
true
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 15 Jan 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100015;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 RC 2 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Finish - This is run after all apps have been upgraded
|
||||
*
|
||||
* @return mixed If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
* @note We opted not to let users run this immediately during the upgrade because of potential issues (it taking a long time and users stopping it or getting frustrated) but we can revisit later
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildItems', array( 'class' => 'IPS\blog\Entry' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\blog\Entry', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Blog', 'count' => 0 ), 5, array( 'class' ) );
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 24 Feb 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100016;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Convert RSS tags
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( 'rss_id, rss_tags', 'blog_rss_import' ) as $feed )
|
||||
{
|
||||
$update = array();
|
||||
if( @unserialize( $feed['rss_tags'] ) !== FALSE )
|
||||
{
|
||||
$update['rss_tags'] = json_encode( unserialize( $feed['rss_tags'] ) );
|
||||
\IPS\Db::i()->update( 'blog_rss_import', $update, array( 'rss_id=?', $feed['rss_id'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Converting RSS feeds";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 RC 5 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 5 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100018;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 RC 5 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
|
||||
/**
|
||||
* Make sure all theme settings are applied to every theme.
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationIndex', array( 'class' => 'IPS\blog\Entry' ), 4 );
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationIndex', array( 'class' => 'IPS\blog\Entry\Comment' ), 4 );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Blog', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_poll_state",
|
||||
{
|
||||
"name": "entry_poll_state",
|
||||
"type": "INT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "ip_lookup",
|
||||
"columns": [
|
||||
"comment_ip_address"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "ip_lookup",
|
||||
"columns": [
|
||||
"entry_ip_address"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "comment_approved",
|
||||
"columns": [
|
||||
"comment_approved"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 15 Mar 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100021;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Convert blog view levels
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
/* Some init */
|
||||
$did = 0;
|
||||
$limit = 0;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'blog_blogs', "blog_view_level IN('private','friends','privateclub')", 'blog_id ASC', array( $limit, 50 ) ) as $blog )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
$blog = \IPS\blog\Blog::constructFromData( $blog );
|
||||
|
||||
/* Figure out type of blog and act accordingly */
|
||||
switch( $blog->view_level )
|
||||
{
|
||||
case 'private':
|
||||
$group = \IPS\Db::i()->insert( 'core_sys_social_groups', array( 'owner_id' => $blog->member_id ) );
|
||||
\IPS\Db::i()->insert( 'core_sys_social_group_members', array( 'group_id' => $group, 'member_id' => $blog->member_id ) );
|
||||
|
||||
$blog->social_group = $group;
|
||||
break;
|
||||
|
||||
case 'friends':
|
||||
case 'privateclub':
|
||||
$group = \IPS\Db::i()->insert( 'core_sys_social_groups', array( 'owner_id' => $blog->member_id ) );
|
||||
|
||||
if( $blog->authorized_users )
|
||||
{
|
||||
$users = explode( ',', trim( $blog->authorized_users, ',' ) );
|
||||
|
||||
foreach( $users as $user )
|
||||
{
|
||||
\IPS\Db::i()->replace( 'core_sys_social_group_members', array( 'group_id' => $group, 'member_id' => $user ) );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->replace( 'core_sys_social_group_members', array( 'group_id' => $group, 'member_id' => $blog->member_id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_sys_social_group_members', array( 'group_id' => $group, 'member_id' => $blog->member_id ) );
|
||||
}
|
||||
|
||||
$blog->social_group = $group;
|
||||
break;
|
||||
}
|
||||
|
||||
$blog->save();
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return $limit + $did;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step1Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step1Count'] ) )
|
||||
{
|
||||
$_SESSION['_step1Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs', "blog_view_level IN('private','friends','privateclub')" )->first();
|
||||
}
|
||||
|
||||
return "Upgrading blogs (Updated so far: " . ( ( $limit > $_SESSION['_step1Count'] ) ? $_SESSION['_step1Count'] : $limit ) . ' out of ' . $_SESSION['_step1Count'] . ')';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_hidden_comments",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.4 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 5 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100027;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.4 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
|
||||
/**
|
||||
* Convert entry images
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? intval( \IPS\Request::i()->extra ) : 0;
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', 'blog_entries', "entry_image<>''", 'entry_id ASC', array( $limit, 1000 ) );
|
||||
|
||||
if ( !$select->count() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
foreach ( $select as $entry )
|
||||
{
|
||||
try
|
||||
{
|
||||
$filePath = \IPS\ROOT_PATH . '/uploads/' . $entry['entry_image'];
|
||||
|
||||
$file = \IPS\File::create( 'core_Attachment', $entry['entry_image'], NULL, NULL, FALSE, $filePath );
|
||||
$attachment = $file->makeAttachment('');
|
||||
$fileName = htmlentities( $attachment['attach_file'], \IPS\HTMLENTITIES, 'UTF-8', TRUE );
|
||||
|
||||
$image = <<<IMAGE
|
||||
<a href="<fileStore.core_Attachment>/{$file}" class="ipsAttachLink ipsAttachLink_image" style="float:left;"><img data-fileid="{$attachment['attach_id']}" src="<fileStore.core_Attachment>/{$file}" class="ipsImage ipsImage_thumbnailed" style="margin:10px;" alt="{$fileName}"></a>
|
||||
IMAGE;
|
||||
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $image . $entry['entry_content'] ), array( 'entry_id=?', $entry['entry_id'] ) );
|
||||
|
||||
$map = array(
|
||||
'attachment_id' => $attachment['attach_id'],
|
||||
'location_key' => 'blog_Entries',
|
||||
'id1' => $entry['entry_id'],
|
||||
'id2' => NULL,
|
||||
'id3' => NULL,
|
||||
'temp' => NULL,
|
||||
);
|
||||
|
||||
\IPS\Db::i()->replace( 'core_attachments_map', $map );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
return $limit + 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Converting entry images";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.5 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 5 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100028;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.5 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
|
||||
/**
|
||||
* Make sure all theme settings are applied to every theme.
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::repairFileUrls('blog');
|
||||
\IPS\Task::queue( 'core', 'RebuildContentImages', array( 'class' => 'IPS\blog\Entry' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContentImages', array( 'class' => 'IPS\blog\Entry\Comment' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentImages', array( 'extension' => 'blog_Blogs' ), 3, array( 'extension' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.9 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 19 Jun 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100035;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.9 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Update widgets
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
$areas = array( 'core_widget_areas' );
|
||||
if ( \IPS\Application::appIsEnabled('cms') )
|
||||
{
|
||||
$areas[] = 'cms_page_widget_areas';
|
||||
}
|
||||
|
||||
foreach ( $areas as $table )
|
||||
{
|
||||
foreach ( \IPS\Db::i()->select( '*', $table ) as $area )
|
||||
{
|
||||
$widgetsColumn = $table == 'core_widget_areas' ? 'widgets' : 'area_widgets';
|
||||
$whereClause = $table == 'core_widget_areas' ? array( 'id=? AND area=?', $area['id'], $area['area'] ) : array( 'area_page_id=? AND area_area=?', $area['area_page_id'], $area['area_area'] );
|
||||
|
||||
$widgets = json_decode( $area[ $widgetsColumn ], TRUE );
|
||||
$update = FALSE;
|
||||
|
||||
foreach ( $widgets as $k => $widget )
|
||||
{
|
||||
if ( $widget['key'] == 'recentEntries' )
|
||||
{
|
||||
$widgets[ $k ]['key'] = 'entryFeed';
|
||||
if ( isset( $widgets[ $k ]['configuration']['number_to_show'] ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_show'] = $widgets[ $k ]['configuration']['number_to_show'];
|
||||
unset( $widgets[ $k ]['configuration']['number_to_show'] );
|
||||
}
|
||||
|
||||
$update = TRUE;
|
||||
}
|
||||
|
||||
if ( $update )
|
||||
{
|
||||
\IPS\Db::i()->update( $table, array( $widgetsColumn => json_encode( $widgets ) ), $whereClause );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "delete",
|
||||
"params": [
|
||||
"core_widgets",
|
||||
[
|
||||
"app=? AND `key`=?",
|
||||
"blog",
|
||||
"recentEntries"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.10 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blogs
|
||||
* @since 07 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_100038;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.10 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
if ( !\IPS\Db::i()->checkForColumn( 'blog_entries', 'entry_is_future_entry' ) )
|
||||
{
|
||||
\IPS\Db::i()->addColumn( 'blog_entries', array(
|
||||
'name' => 'entry_is_future_entry',
|
||||
'type' => "TINYINT",
|
||||
'length' => 1,
|
||||
'allow_null' => false,
|
||||
'default' => "0",
|
||||
'comment' => "Flag to show if an entry is set to be published in the future via the task",
|
||||
'unsigned' => true,
|
||||
) );
|
||||
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_is_future_entry' => 1 ), array( "entry_date>? AND entry_status=?", time(), 'draft' ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// You can create as many additional methods (step2, step3, etc.) as is necessary.
|
||||
// Each step will be executed in a new HTTP request
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key IN('blog_use_friendlyurls', 'blog_friendly_url', 'blog_friendlyurl_path', 'blog_boardindex_path');";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_22000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 22000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE blog_lastinfo CHANGE blog_tag_cloud blog_tag_cloud MEDIUMTEXT;";
|
||||
$SQL[] = "UPDATE blog_lastinfo SET blog_tag_cloud='';";
|
||||
|
||||
if( ! \IPS\Db::i()->checkForColumn( 'blog_themes', 'theme_css_overwrite' ) )
|
||||
{
|
||||
$SQL[] = "ALTER TABLE blog_themes ADD theme_css_overwrite TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_22002;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 22002 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
// Add comment_approved for new comments functionality:
|
||||
$SQL[] = "ALTER TABLE blog_comments ADD comment_approved INT(1) DEFAULT '0'";
|
||||
$SQL[] = "UPDATE blog_comments SET comment_approved = 1 WHERE comment_queued = 0";
|
||||
$SQL[] = "UPDATE blog_comments SET comment_approved = 0 WHERE comment_queued = 1";
|
||||
|
||||
// Get DB prefix:
|
||||
$PRE = \IPS\Db::i()->prefix;
|
||||
|
||||
// Convert tracker to like:
|
||||
if ( \IPS\Db::i()->checkForTable('blog_tracker') )
|
||||
{
|
||||
if( \IPS\Db::i()->checkForTable('core_like') )
|
||||
{
|
||||
$SQL[] = "INSERT IGNORE INTO `{$PRE}core_like` (like_id, like_lookup_id, like_app, like_area, like_rel_id, like_member_id, like_is_anon, like_added, like_notify_do, like_notify_freq) SELECT MD5(CONCAT('blog;blog;', blog_id, ';', member_id)), MD5(CONCAT('blog;blog;', blog_id)), 'blog', 'blog', blog_id, member_id, 0, UNIX_TIMESTAMP(), 1, 'immediate' FROM `{$PRE}blog_tracker`";
|
||||
|
||||
$SQL[] = "INSERT IGNORE INTO `{$PRE}core_like` (like_id, like_lookup_id, like_app, like_area, like_rel_id, like_member_id, like_is_anon, like_added, like_notify_do, like_notify_freq) SELECT MD5(CONCAT('blog;entries;', entry_id, ';', member_id)), MD5(CONCAT('blog;entries;', entry_id)), 'blog', 'entries', entry_id, member_id, 0, UNIX_TIMESTAMP(), 1,'immediate' FROM `{$PRE}blog_tracker` WHERE entry_id <> 0 AND entry_id IS NOT NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$SQL[] = "INSERT IGNORE INTO `{$PRE}core_follow` (follow_id, follow_app, follow_area, follow_rel_id, follow_member_id, follow_is_anon, follow_added, follow_notify_do, follow_notify_freq) SELECT MD5(CONCAT('blog;blog;', blog_id, ';', member_id)), 'blog', 'blog', blog_id, member_id, 0, UNIX_TIMESTAMP(), 1, 'immediate' FROM `{$PRE}blog_tracker`";
|
||||
|
||||
$SQL[] = "INSERT IGNORE INTO `{$PRE}core_follow` (follow_id, follow_app, follow_area, follow_rel_id, follow_member_id, follow_is_anon, follow_added, follow_notify_do, follow_notify_freq) SELECT MD5(CONCAT('blog;entries;', entry_id, ';', member_id)), 'blog', 'entries', entry_id, member_id, 0, UNIX_TIMESTAMP(), 1,'immediate' FROM `{$PRE}blog_tracker` WHERE entry_id <> 0 AND entry_id IS NOT NULL";
|
||||
}
|
||||
|
||||
$SQL[] = "DROP TABLE blog_tracker";
|
||||
$SQL[] = "DROP TABLE blog_tracker_queue";
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_23000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 23000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Add indexs on blog_views
|
||||
$SQL[] = "ALTER TABLE blog_views ADD INDEX ( blog_id );";
|
||||
|
||||
// Remove unused settings
|
||||
$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key='blog_exturl_newwindow';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_23002;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 23002 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/* Get DB functions/prefix */
|
||||
$PRE = \IPS\Db::i()->prefix;
|
||||
$DB = \IPS\Db::i();
|
||||
|
||||
// Remove unused column - sometimes we don't have it thought...
|
||||
if ( $DB->checkForColumn( 'blog_comments', 'comment_queued' ) )
|
||||
{
|
||||
$SQL[] = "ALTER TABLE blog_comments DROP comment_queued;";
|
||||
}
|
||||
|
||||
$SQL[] = "ALTER TABLE blog_comments CHANGE ip_address ip_address VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE blog_trackback CHANGE ip_address ip_address VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE blog_trackback_spamlogs CHANGE ip_address ip_address VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE blog_voters CHANGE ip_address ip_address VARCHAR( 46 ) NOT NULL;";
|
||||
$SQL[] = "ALTER TABLE blog_akismet_logs CHANGE log_date log_date INT( 10 ) NOT NULL DEFAULT '0';";
|
||||
|
||||
/* Drop unused fields */
|
||||
$SQL[] = "ALTER TABLE blog_comments DROP comment_use_sig, DROP comment_use_emo, DROP comment_html_state, DROP comment_append_edit,
|
||||
DROP comment_edit_name, DROP INDEX comment_entry_id, ADD INDEX ( entry_id, comment_approved );";
|
||||
|
||||
/* Mess up indexes */
|
||||
$SQL[] = "ALTER TABLE blog_entries DROP INDEX entry_status, ADD INDEX entry_status ( entry_status, entry_last_update );";
|
||||
|
||||
|
||||
/* Remove custom skin choice */
|
||||
$SQL[] = "UPDATE blog_blogs SET blog_skin_id=0;";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_24000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 24000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE blog_blogs DROP COLUMN blog_header_id;";
|
||||
$SQL[] = "DROP TABLE blog_headers;";
|
||||
|
||||
$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key IN ('blog_enable_dheader','blog_cache_dheader','blog_headers');";
|
||||
|
||||
$SQL[] = "ALTER TABLE blog_entries ADD COLUMN entry_image VARCHAR(255) NOT NULL DEFAULT '', ADD COLUMN entry_views INT(10) NOT NULL DEFAULT 0;";
|
||||
|
||||
$SQL[] = "ALTER TABLE blog_views ADD COLUMN entry_id INT(10) NOT NULL DEFAULT 0;";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_25000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 25000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Some installs may still have this old (hidden) settings group installed
|
||||
$SQL[] = "DELETE FROM core_sys_settings_titles WHERE conf_title_keyword='blog_masks';";
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_25004;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 25004 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Reset short entries (#35240)
|
||||
$SQL[] = "UPDATE blog_entries SET entry_short='';";
|
||||
|
||||
|
||||
# New indexes, to avoid filesorts & full table scans
|
||||
$SQL[] = "ALTER TABLE blog_comments DROP INDEX comment_member_id, ADD INDEX comment_member_id ( member_id, comment_date );";
|
||||
$SQL[] = "ALTER TABLE blog_category_mapping DROP INDEX map_entry_id, ADD INDEX map_blog_id ( map_blog_id, map_entry_id );";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_25005;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'blog', 25005 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,779 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"comment_text"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_name"
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_content"
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
"blog_type"
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
"blog_grabber",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "blog_grabber",
|
||||
"length": {
|
||||
"0": null,
|
||||
"2": null
|
||||
},
|
||||
"columns": {
|
||||
"0": "blog_disabled",
|
||||
"2": "blog_view_level"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
[
|
||||
"blog_exturl",
|
||||
"blog_num_exthits",
|
||||
"blog_private",
|
||||
"blog_last_delete",
|
||||
"blog_skin_id",
|
||||
"blog_friendly_url",
|
||||
"blog_theme_id",
|
||||
"blog_theme_custom",
|
||||
"blog_theme_final",
|
||||
"blog_theme_approved",
|
||||
"blog_categories",
|
||||
"blog_lentry_banish",
|
||||
"blog_last_udate"
|
||||
]
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
[
|
||||
"entry_trackbacks",
|
||||
"entry_sent_trackbacks",
|
||||
"entry_hastags",
|
||||
"entry_category",
|
||||
"entry_tag_cache",
|
||||
"entry_banish",
|
||||
"entry_rating_total",
|
||||
"entry_rating_count",
|
||||
"entry_last_vote",
|
||||
"entry_last_comment",
|
||||
"entry_last_comment_date",
|
||||
"entry_last_comment_name",
|
||||
"entry_has_attach",
|
||||
"entry_html_state",
|
||||
"entry_use_emo",
|
||||
"entry_short",
|
||||
"entry_rss_import"
|
||||
]
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
"member_id",
|
||||
{
|
||||
"name": "blog_member_id",
|
||||
"type": "MEDIUMINT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"9": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"blog_id",
|
||||
{
|
||||
"name": "entry_blog_id",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"10": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"entry_id",
|
||||
{
|
||||
"name": "comment_entry_id",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"11": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"member_id",
|
||||
{
|
||||
"name": "comment_member_id",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"12": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"member_name",
|
||||
{
|
||||
"name": "comment_member_name",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"13": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
"ip_address",
|
||||
{
|
||||
"name": "comment_ip_address",
|
||||
"type": "VARCHAR",
|
||||
"length": 46,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"14": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_hidden",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"15": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_pinned",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"16": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_ip_address",
|
||||
"type": "VARCHAR",
|
||||
"length": 46,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"17": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry",
|
||||
{
|
||||
"name": "entry_content",
|
||||
"type": "TEXT",
|
||||
"length": 0,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"18": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_count_entries",
|
||||
"type": "INT",
|
||||
"length": 11,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"19": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_count_comments",
|
||||
"type": "INT",
|
||||
"length": 11,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"20": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_count_entries_hidden",
|
||||
"type": "INT",
|
||||
"length": 11,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"21": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_count_comments_hidden",
|
||||
"type": "INT",
|
||||
"length": 11,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"22": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_rating_average",
|
||||
"type": "INT",
|
||||
"length": 11,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"23": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_hidden",
|
||||
{
|
||||
"name": "entry_hidden",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"24": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_future_date",
|
||||
{
|
||||
"name": "entry_publish_date",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"25": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"blog_rssimport",
|
||||
[
|
||||
"rss_cats",
|
||||
"rss_per_go",
|
||||
"rss_count",
|
||||
"rss_in_progress"
|
||||
]
|
||||
]
|
||||
},
|
||||
"26": {
|
||||
"method": "renameTable",
|
||||
"params": [
|
||||
"blog_rssimport",
|
||||
"blog_rss_import"
|
||||
]
|
||||
},
|
||||
"27": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_rss_import",
|
||||
{
|
||||
"name": "rss_member",
|
||||
"type": "MEDIUMINT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"28": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
{
|
||||
"name": "comment_edit_member_name",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"29": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_comments",
|
||||
{
|
||||
"name": "comment_edit_show",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"30": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
"entry_poll_state",
|
||||
{
|
||||
"name": "entry_poll_state",
|
||||
"type": "INT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"31": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_rss_import",
|
||||
{
|
||||
"name": "rss_import_show_link",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Text to show for link to full article",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"32": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_cover_photo",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"33": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_cover_photo_offset",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"34": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_cover_photo",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"35": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_cover_photo_offset",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"36": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_social_group",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The social group ID, is this is a private blog",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"37": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_entries",
|
||||
{
|
||||
"name": "entry_future_date",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"38": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"blog_blogs",
|
||||
{
|
||||
"name": "blog_count_entries_future",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"39": {
|
||||
"method": "createTable",
|
||||
"params": [
|
||||
{
|
||||
"name": "blog_rss_imported",
|
||||
"columns": {
|
||||
"rss_imported_guid": {
|
||||
"allow_null": false,
|
||||
"auto_increment": false,
|
||||
"binary": false,
|
||||
"comment": "",
|
||||
"decimals": null,
|
||||
"default": "0",
|
||||
"length": 32,
|
||||
"name": "rss_imported_guid",
|
||||
"type": "CHAR",
|
||||
"unsigned": false,
|
||||
"values": [],
|
||||
"zerofill": false
|
||||
},
|
||||
"rss_imported_entry_id": {
|
||||
"allow_null": false,
|
||||
"auto_increment": false,
|
||||
"binary": false,
|
||||
"comment": "",
|
||||
"decimals": null,
|
||||
"default": "0",
|
||||
"length": 10,
|
||||
"name": "rss_imported_entry_id",
|
||||
"type": "INT",
|
||||
"unsigned": false,
|
||||
"values": [],
|
||||
"zerofill": false
|
||||
},
|
||||
"rss_imported_impid": {
|
||||
"allow_null": false,
|
||||
"auto_increment": false,
|
||||
"binary": false,
|
||||
"comment": "",
|
||||
"decimals": null,
|
||||
"default": "0",
|
||||
"length": 10,
|
||||
"name": "rss_imported_impid",
|
||||
"type": "INT",
|
||||
"unsigned": false,
|
||||
"values": [],
|
||||
"zerofill": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"PRIMARY": {
|
||||
"type": "primary",
|
||||
"name": "PRIMARY",
|
||||
"length": [
|
||||
null
|
||||
],
|
||||
"columns": [
|
||||
"rss_imported_guid"
|
||||
]
|
||||
},
|
||||
"rss_imported_impid": {
|
||||
"type": "key",
|
||||
"name": "rss_imported_impid",
|
||||
"length": [
|
||||
null
|
||||
],
|
||||
"columns": [
|
||||
"rss_imported_impid"
|
||||
]
|
||||
}
|
||||
},
|
||||
"comment": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Blog
|
||||
* @since 03 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\setup\upg_40000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Act on blogs
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
/* Some init */
|
||||
$did = 0;
|
||||
$limit = 0;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'blog_blogs', null, 'blog_id ASC', array( $limit, 50 ) ) as $blog )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$original = $blog;
|
||||
$blog = \IPS\blog\Blog::constructFromData( $blog );
|
||||
|
||||
$did++;
|
||||
|
||||
/* Remove external blogs */
|
||||
if( $blog->type == 'external' )
|
||||
{
|
||||
$blog->delete();
|
||||
}
|
||||
|
||||
/* Convert settings from serialize to json, ignore anything except allowrss and convert allowrss to bool */
|
||||
$settings = unserialize( $blog->settings );
|
||||
$blog->settings = array( 'allowrss' => (bool) $settings['allowrss'] );
|
||||
|
||||
/* Update counts */
|
||||
$blog->count_entries = (int) \IPS\Db::i()->select( 'COUNT(*)', 'blog_entries', array( "entry_blog_id=? and entry_status=?", $blog->id, 'published' ) )->first();
|
||||
$blog->count_entries_hidden = (int) \IPS\Db::i()->select( 'COUNT(*)', 'blog_entries', array( "entry_blog_id=? and entry_status=?", $blog->id, 'draft' ) )->first();
|
||||
$blog->count_comments = (int) \IPS\Db::i()->select( 'SUM(entry_num_comments)', 'blog_entries', array( "entry_blog_id=?", $blog->id ) )->first();
|
||||
$blog->count_comments_hidden = (int) \IPS\Db::i()->select( 'SUM(entry_queued_comments)', 'blog_entries', array( "entry_blog_id=?", $blog->id ) )->first();
|
||||
|
||||
/* Wipe out member id if this is a group blog */
|
||||
if( $blog->groupblog_ids )
|
||||
{
|
||||
$blog->member_id = 0;
|
||||
}
|
||||
|
||||
/* Set language strings */
|
||||
\IPS\Lang::saveCustom( 'blog', "blogs_blog_{$blog->id}", html_entity_decode( $original['blog_name'], ENT_QUOTES, 'UTF-8' ) );
|
||||
\IPS\Lang::saveCustom( 'blog', "blogs_blog_{$blog->id}_desc", \IPS\Text\Parser::parseStatic( $original['blog_desc'], TRUE, NULL, NULL, TRUE, TRUE, TRUE ) );
|
||||
\IPS\Lang::saveCustom( 'blog', "blogs_groupblog_name_{$blog->id}", html_entity_decode( $original['blog_groupblog_name'], ENT_QUOTES, 'UTF-8' ) );
|
||||
|
||||
$blog->save();
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return $limit + $did;
|
||||
}
|
||||
else
|
||||
{
|
||||
$columns = array( 'blog_name', 'blog_desc', 'blog_groupblog_name' );
|
||||
|
||||
if( \IPS\Db::i()->checkForColumn( 'blog_blogs', 'blog_type' ) )
|
||||
{
|
||||
$columns[] = 'blog_type';
|
||||
}
|
||||
|
||||
\IPS\Db::i()->dropColumn( 'blog_blogs', $columns );
|
||||
|
||||
unset( $_SESSION['_step1Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step1Count'] ) )
|
||||
{
|
||||
$_SESSION['_step1Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first();
|
||||
}
|
||||
|
||||
return "Upgrading blogs (Updated so far: " . ( ( $limit > $_SESSION['_step1Count'] ) ? $_SESSION['_step1Count'] : $limit ) . ' out of ' . $_SESSION['_step1Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert ratings
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step2()
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_ratings',
|
||||
\IPS\Db::i()->select( "NULL, 'IPS\\blog\\Entry', entry_id, member_id, rating, ''", 'blog_ratings', NULL, NULL, NULL, array( 'entry_id', 'member_id' ) )
|
||||
);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Upgrading blog ratings";
|
||||
}
|
||||
|
||||
/**
|
||||
* Update blog entry hidden status
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step3()
|
||||
{
|
||||
/* 1 means approved */
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_hidden' => 1 ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Upgrading blog entries";
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert blog categories to tags
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step4()
|
||||
{
|
||||
/* Some init */
|
||||
$did = 0;
|
||||
$limit = 0;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'blog_category_mapping', null, 'map_entry_id ASC', array( $limit, 250 ) ) as $map )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
try
|
||||
{
|
||||
$entry = \IPS\blog\Entry::load( $map['map_entry_id'] );
|
||||
$tags = $entry->tags();
|
||||
|
||||
$newTag = \IPS\Db::i()->select( 'category_title', 'blog_categories', array( 'category_id=?', $map['map_category_id'] ) )->first();
|
||||
|
||||
$tags[] = $newTag;
|
||||
$entry->setTags( array( 'tags' => $tags, 'prefix' => $entry->prefix() ) );
|
||||
$entry->save();
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return $limit + $did;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step4Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step4Count'] ) )
|
||||
{
|
||||
$_SESSION['_step4Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'blog_category_mapping' )->first();
|
||||
}
|
||||
|
||||
return "Converting blog categories to tags (Converted so far: " . ( ( $limit > $_SESSION['_step4Count'] ) ? $_SESSION['_step4Count'] : $limit ) . ' out of ' . $_SESSION['_step4Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Update serialized blog settings
|
||||
*
|
||||
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step5()
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->query( "ALTER TABLE " . \IPS\Db::i()->prefix . "core_groups ADD COLUMN g_blog_allowlocal TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN g_blog_maxblogs INT(10) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN g_blog_allowownmod TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN g_blog_allowdelete TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN g_blog_allowcomment TINYINT(1) NOT NULL DEFAULT '0'" );
|
||||
}
|
||||
catch ( \IPS\Db\Exception $e )
|
||||
{
|
||||
if ( $e->getCode() != 1060 )
|
||||
{
|
||||
/* 1060: Column exists */
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
if( \IPS\Db::i()->checkForColumn( 'core_groups', 'g_blog_settings' ) )
|
||||
{
|
||||
/* Groups */
|
||||
foreach (\IPS\Member\Group::groups() as $group)
|
||||
{
|
||||
if( $group->g_blog_settings )
|
||||
{
|
||||
$settings = unserialize($group->g_blog_settings);
|
||||
|
||||
$group->g_blog_allowlocal = ( isset( $settings['g_blog_allowlocal'] ) ) ? (int) $settings['g_blog_allowlocal'] : 0;
|
||||
$group->g_blog_maxblogs = ( isset( $settings['g_blog_maxblogs'] ) ) ? (int) $settings['g_blog_maxblogs'] : 0;
|
||||
$group->g_blog_allowownmod = ( isset( $settings['g_blog_allowownmod'] ) ) ? (int) $settings['g_blog_allowownmod'] : 0;
|
||||
$group->g_blog_allowdelete = ( isset( $settings['g_blog_allowdelete'] ) ) ? (int) $settings['g_blog_allowdelete'] : 0;
|
||||
$group->g_blog_allowcomment = ( isset( $settings['g_blog_allowcomment'] ) ) ? (int) $settings['g_blog_allowcomment'] : 0;
|
||||
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->dropColumn( 'core_groups', 'g_blog_settings' );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step5CustomTitle()
|
||||
{
|
||||
return "Converting blog group settings";
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish - This is run after all apps have been upgraded
|
||||
*
|
||||
* @return mixed If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
* @note We opted not to let users run this immediately during the upgrade because of potential issues (it taking a long time and users stopping it or getting frustrated) but we can revisit later
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\blog\Entry' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\blog\Entry\Comment' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentPosts', array( 'extension' => 'blog_Blogs' ), 2 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user