Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Applications Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -135,6 +135,11 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
unset( \IPS\Data\Store::i()->convert_apps );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Session data store
|
||||
*/
|
||||
protected $_sessionData = null;
|
||||
|
||||
/**
|
||||
* Save Session Data for this application
|
||||
@@ -145,6 +150,8 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
public function set__session( $value )
|
||||
{
|
||||
\IPS\Db::i()->update( 'convert_app_sessions', array( 'session_app_data' => json_encode( $value ) ), array( 'session_app_id=?', $this->app_id ) );
|
||||
|
||||
$this->_sessionData = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,9 +161,16 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
*/
|
||||
public function get__session()
|
||||
{
|
||||
/* Use ready-cached session data */
|
||||
if( $this->_sessionData !== null )
|
||||
{
|
||||
return $this->_sessionData;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return json_decode( \IPS\Db::i()->select( 'session_app_data', 'convert_app_sessions', array( 'session_app_id=?', $this->app_id ) )->first(), TRUE );
|
||||
$this->_sessionData = json_decode( \IPS\Db::i()->select( 'session_app_data', 'convert_app_sessions', array( 'session_app_id=?', $this->app_id ) )->first(), TRUE );
|
||||
return $this->_sessionData;
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
@@ -253,14 +267,14 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an IPS Community Suite ID from a Foreign ID.
|
||||
* Retrieves an Invision Community ID from a Foreign ID.
|
||||
*
|
||||
* @param mixed $foreign_id The Foreign ID
|
||||
* @param string|array $type The type of item, or an array of types to check.
|
||||
* @param boolean $parent If set to TRUE, then retrieves from the parent application if one is available.
|
||||
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
|
||||
*
|
||||
* @return integer The IPS Community Suite ID.
|
||||
* @return integer The Invision Community ID.
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
public function getLink( $foreign_id, $type, $parent=FALSE, $mainTable=FALSE )
|
||||
@@ -272,9 +286,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
$key = md5( json_encode( $type ) );
|
||||
|
||||
if ( isset( $this->linkCache[$key][$foreign_id] ) )
|
||||
if ( isset( $this->linkCache[ $key ][ $foreign_id ] ) )
|
||||
{
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
|
||||
$table = 'convert_link';
|
||||
@@ -300,18 +314,18 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
try
|
||||
{
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, ( $parent === TRUE ) ? $this->parent : $this->app_id ) )->first();
|
||||
$this->linkCache[$key][$foreign_id] = $link;
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, ( $parent === TRUE AND $this->parent ) ? $this->parent : $this->app_id ), 'link_id DESC' )->first();
|
||||
$this->linkCache[ $key ][ $foreign_id ] = $link;
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* If lookup failed, and we have a parent, try it anyway */
|
||||
try
|
||||
{
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, $this->parent ) )->first();
|
||||
$this->linkCache[$key][$foreign_id] = $link;
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, $this->parent ), 'link_id DESC' )->first();
|
||||
$this->linkCache[ $key ][ $foreign_id ] = $link;
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
@@ -326,14 +340,14 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
protected $siblingLinkCache = array();
|
||||
|
||||
/**
|
||||
* Retrieves an IPS Community Suite iD from a Foriegn ID in a Sibling Application
|
||||
* Retrieves an Invision Community iD from a Foriegn ID in a Sibling Application
|
||||
*
|
||||
* @param mixed $foreign_id The Foreign ID.
|
||||
* @param string $type The type of item.
|
||||
* @param string $sibling The sibling software library.
|
||||
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
|
||||
*
|
||||
* @return inteer The IPS Community Suite ID.
|
||||
* @return inteer The Invision Community ID.
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
public function getSiblingLink( $foreign_id, $type, $sibling, $mainTable=FALSE )
|
||||
@@ -356,9 +370,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a foreign ID to IPS Community Suite ID reference to the convert_link tables.
|
||||
* Saves a foreign ID to Invision Community ID reference to the convert_link tables.
|
||||
*
|
||||
* @param integer $ips_id The IPS Community Suite ID
|
||||
* @param integer $ips_id The Invision Community ID
|
||||
* @param mixed $foreign_id The Foreign ID
|
||||
* @param string $type The type of item
|
||||
* @param boolean $duplicate If TRUE, then this item is a duplicate and was merged into existing $ips_id
|
||||
@@ -395,9 +409,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a link exists for an IPS Community Suite ID
|
||||
* Checks to see if a link exists for an Invision Community ID
|
||||
*
|
||||
* @param integer $ips_id The IPS Community Suite ID.
|
||||
* @param integer $ips_id The Invision Community ID.
|
||||
* @return void
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
@@ -491,7 +505,7 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
case 'board':
|
||||
case 'ccs':
|
||||
$this->sw = $this->_data['sw'];
|
||||
$this->sw = $this->sw;
|
||||
$this->save();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user