Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -5,19 +5,22 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Joomla Pages Converter
|
||||
*/
|
||||
class _Joomla extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -125,11 +128,18 @@ class _Joomla extends \IPS\convert\Software
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
try
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( "f_recount_cms_categories" );
|
||||
return array( "f_recount_cms_categories" );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* vBulletin Pages Converter
|
||||
*/
|
||||
class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -79,7 +82,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* If this is vB4, what is the content type ID for the cms? */
|
||||
if ( static::$_articleContentType === NULL AND ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) AND $needDB )
|
||||
if ( static::$_articleContentType === NULL AND ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) AND $needDB )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -149,12 +152,19 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
switch( $table )
|
||||
{
|
||||
case 'cms_widget':
|
||||
$blocksWeCanConvert = array();
|
||||
foreach( $this->db->select( 'widgettypeid', 'cms_widgettype', array( \IPS\Db::i()->in( 'class', array( 'Rss', 'Static' ) ) ) ) AS $typeid )
|
||||
try
|
||||
{
|
||||
$blocksWeCanConvert[] = $typeid;
|
||||
$blocksWeCanConvert = array();
|
||||
foreach( $this->db->select( 'widgettypeid', 'cms_widgettype', array( \IPS\Db::i()->in( 'class', array( 'Rss', 'Static' ) ) ) ) AS $typeid )
|
||||
{
|
||||
$blocksWeCanConvert[] = $typeid;
|
||||
}
|
||||
return $this->db->select( 'COUNT(*)', 'cms_widget', array( $this->db->in( 'widgettypeid', $blocksWeCanConvert ) ) )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
throw new \IPS\convert\Exception( sprintf( \IPS\Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
}
|
||||
return $this->db->select( 'COUNT(*)', 'cms_widget', array( $this->db->in( 'widgettypeid', $blocksWeCanConvert ) ) )->first();
|
||||
break;
|
||||
|
||||
case 'page':
|
||||
@@ -190,23 +200,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/**
|
||||
* Fix Post Data
|
||||
*
|
||||
* @param string Post
|
||||
* @param string $post Post
|
||||
* @return string Fixed Posts
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
{
|
||||
return \IPS\convert\Software\Core\Vbulletin::fixPostData( $post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getPreConversionInformation()
|
||||
{
|
||||
return 'convert_vb_preconvert';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Setting Value - useful for global settings that need to be translated to group or member settings
|
||||
@@ -268,7 +268,12 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
|
||||
foreach( $this->fetch( 'cms_widget', 'widgetid', array( \IPS\Db::i()->in( 'widgettypeid', $blocksWeCanConvert ) ) ) AS $block )
|
||||
{
|
||||
$config = $this->db->select( 'name, value', 'cms_widgetconfig', array( "widgetid=?", $block['widgetid'] ) )->setKeyField( 'name' )->setValueField( 'value' )->first();
|
||||
$config = array();
|
||||
|
||||
foreach( $this->db->select( 'name, value', 'cms_widgetconfig', array( "widgetid=?", $block['widgetid'] ) ) as $_c )
|
||||
{
|
||||
$config[ $_c['name'] ] = $_c['value'];
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'block_id' => $block['widgetid'],
|
||||
@@ -288,7 +293,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'type' => 'plugin',
|
||||
'plugin_app' => 'cms',
|
||||
) : NULL,
|
||||
'block_content' => ( $block['widgettypeid'] != $rssTypeId ) ? $config['statichtml'] : NULL,
|
||||
'block_content' => ( $block['widgettypeid'] != $rssTypeId AND !empty( $config['statichtml'] ) ) ? $config['statichtml'] : NULL,
|
||||
);
|
||||
|
||||
$libraryClass->convertCmsBlock( $info );
|
||||
@@ -407,9 +412,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public function convertCmsDatabaseRecords()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'contentid' );
|
||||
|
||||
|
||||
$cmsCategories = iterator_to_array( $this->db->select( 'category, categoryid', 'cms_category' )->setKeyField( 'categoryid' )->setValueField( 'category' ) );
|
||||
|
||||
foreach( $this->fetch( 'cms_article', 'contentid' ) AS $row )
|
||||
{
|
||||
try
|
||||
@@ -423,29 +429,27 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$category = $this->db->select( 'categoryid', 'cms_nodecategory', array( "nodeid=?", $node['nodeid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
|
||||
$categories = iterator_to_array( $this->db->select( 'categoryid', 'cms_nodecategory', array( "nodeid=?", $node['nodeid'] ) ) );
|
||||
|
||||
if( !\count( $categories ) )
|
||||
{
|
||||
/* Create one */
|
||||
try
|
||||
{
|
||||
$this->app->getLink( '__orphan__', 'cms_database_categories' );
|
||||
|
||||
$category = '__orphan__';
|
||||
$categories = array( '__orphan__' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$libraryClass->convertCmsDatabaseCategory( array(
|
||||
'category_id' => '__orphan__',
|
||||
'category_database_id' => 1,
|
||||
'category_name' => "vBulletin Articles",
|
||||
'category_fields' => array( 'article_title', 'article_content' )
|
||||
'category_id' => '__orphan__',
|
||||
'category_database_id' => 1,
|
||||
'category_name' => "vBulletin Articles",
|
||||
'category_fields' => array( 'article_title', 'article_content' )
|
||||
) );
|
||||
|
||||
$category = '__orphan__';
|
||||
|
||||
$categories = array( '__orphan__' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,8 +458,11 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
$keywords[] = trim( $word );
|
||||
}
|
||||
|
||||
// First category
|
||||
$category = array_shift( $categories );
|
||||
|
||||
$libraryClass->convertCmsDatabaseRecord( array(
|
||||
$id = $libraryClass->convertCmsDatabaseRecord( array(
|
||||
'record_id' => $row['contentid'],
|
||||
'record_database_id' => 1,
|
||||
'member_id' => $node['userid'],
|
||||
@@ -478,6 +485,76 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
1 => $nodeinfo['title'],
|
||||
2 => $row['pagetext']
|
||||
) );
|
||||
|
||||
/* Need to know database for tag conversion */
|
||||
try
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Cannot find it, we can't convert tags */
|
||||
$libraryClass->setLastKeyValue( $row['contentid'] );
|
||||
}
|
||||
|
||||
/* Convert extra unassigned categories as tags */
|
||||
$convertedTags = array();
|
||||
if( \count( $categories ) )
|
||||
{
|
||||
foreach( $categories as $key )
|
||||
{
|
||||
if( isset( $convertedTags[ $cmsCategories[ $key ] ] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$libraryClass->convertTag( array(
|
||||
'tag_meta_app' => 'cms',
|
||||
'tag_meta_area' => "records{$database}",
|
||||
'tag_meta_parent_id' => $category,
|
||||
'tag_meta_id' => $row['contentid'],
|
||||
'tag_text' => $cmsCategories[ $key ],
|
||||
'tag_member_id' => $node['userid'],
|
||||
'tag_prefix' => 0,
|
||||
'tag_meta_link' => 'cms_custom_database_' . $database,
|
||||
'tag_meta_parent_link' => 'cms_database_categories',
|
||||
) );
|
||||
|
||||
if( $id )
|
||||
{
|
||||
$convertedTags[ $cmsCategories[ $key ] ] = $cmsCategories[ $key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert normal article tags */
|
||||
$tags = $this->db->select( '*', 'tagcontent', array( "contenttypeid=? AND contentid=?", static::$_articleContentType, $row['contentid'] ) )
|
||||
->join( 'tag', 'tagcontent.tagid=tag.tagid');
|
||||
|
||||
foreach( $tags AS $tag )
|
||||
{
|
||||
if( isset( $convertedTags[ $tag['tagtext'] ] ) OR ( $tag['canonicaltagid'] > 0 AND $tag['canonicaltagid'] != $tag['tagid'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = $libraryClass->convertTag( array(
|
||||
'tag_meta_app' => 'cms',
|
||||
'tag_meta_area' => "records{$database}",
|
||||
'tag_meta_parent_id' => $category,
|
||||
'tag_meta_id' => $tag['contentid'],
|
||||
'tag_text' => $tag['tagtext'],
|
||||
'tag_member_id' => $tag['userid'],
|
||||
'tag_prefix' => 0,
|
||||
'tag_meta_link' => 'cms_custom_database_' . $database,
|
||||
'tag_meta_parent_link' => 'cms_database_categories',
|
||||
) );
|
||||
|
||||
if( $id )
|
||||
{
|
||||
$convertedTags[ $tag['tagtext'] ] = $tag['tagtext'];
|
||||
}
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['contentid'] );
|
||||
}
|
||||
@@ -494,9 +571,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records'. $database ), 3, array( 'class' ) );
|
||||
|
||||
// Uncomment this once Tags are implemented for the cms;
|
||||
# \IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -522,7 +597,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$where = NULL;
|
||||
$column = NULL;
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
if ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) )
|
||||
{
|
||||
$where = array( "contenttypeid=?", static::$_articleContentType );
|
||||
$column = 'contentid';
|
||||
@@ -533,7 +608,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
try
|
||||
{
|
||||
$vbRecordId = $this->db->select( 'contentid', 'cms_article', array( "contentid=?", $attachment[ $column ] ) )->first();
|
||||
$vbRecordId = $this->db->select( 'contentid', 'cms_node', array( "nodeid=? AND contenttypeid=?", $attachment[ $column ], static::$_articleContentType ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
@@ -545,7 +620,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
if ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) )
|
||||
{
|
||||
$filedata = $this->db->select( '*', 'filedata', array( "filedataid=?", $attachment['filedataid'] ) )->first();
|
||||
}
|
||||
@@ -555,12 +630,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$filedata['filedataid'] = $attachment['attachmentid'];
|
||||
}
|
||||
|
||||
$map = array(
|
||||
'id1' => $vbRecordId,
|
||||
'id2' => NULL,
|
||||
'id3' => 1
|
||||
);
|
||||
|
||||
$info = array(
|
||||
'attach_id' => $attachment['attachmentid'],
|
||||
'attach_file' => $attachment['filename'],
|
||||
@@ -584,26 +653,33 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $path . '/' . $attachment['filedataid'] . '.attach';
|
||||
}
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
/* The database is hardcoded to 1 while the conversion, so we have to use 1 here */
|
||||
$dbId = $this->app->getLink( 1, 'cms_databases' );
|
||||
$dbName = "cms_custom_database_" . $dbId;
|
||||
|
||||
/* Get the database object */
|
||||
$ipsDb = \IPS\cms\Databases::load( $dbId );
|
||||
|
||||
$map = array(
|
||||
'id1' => $vbRecordId,
|
||||
'id2' => 2,
|
||||
'id2_type' => 'cms_database_fields',
|
||||
'id3' => 1
|
||||
);
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
try
|
||||
{
|
||||
$recordId = $this->app->getLink( $attachment[ $column ], 'cms_custom_database_' . $dbId );
|
||||
$recordId = $this->app->getLink( $vbRecordId, 'cms_custom_database_' . $dbId );
|
||||
|
||||
/* Get the database object */
|
||||
$ipsDb = \IPS\cms\Databases::load( $dbId);
|
||||
$post = \IPS\Db::i()->select( 'field_' . $ipsDb->field_content, $dbName, array( "primary_id_field=?", $recordId ) )->first();
|
||||
|
||||
$post = \IPS\Db::i()->select( $ipsDb->field_content, $dbName, array( "primary_id_field=?", $recordId ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", $post ) )
|
||||
if ( preg_match( "/\[ATTACH([^\]]+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( $dbName, array( 'field_2' => $post ), array( "primary_id_field=?", $recordId ) );
|
||||
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( $dbName, array( 'field_' . $ipsDb->field_content => $post ), array( "primary_id_field=?", $recordId ) );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e ) { }
|
||||
@@ -641,8 +717,8 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(
|
||||
'options' => array(
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_file_system' ),
|
||||
),
|
||||
'userSuppliedInput' => 'file_system',
|
||||
),
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wordpress Pages Converter
|
||||
*/
|
||||
class _Wordpress extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -178,15 +181,22 @@ class _Wordpress extends \IPS\convert\Software
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records'. $database ), 3, array( 'class' ) );
|
||||
try
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records' . $database ), 3, array( 'class' ) );
|
||||
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_records', 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_database_comments', 'class' => 'IPS\cms\Records\Comment' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_records', 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_database_comments', 'class' => 'IPS\cms\Records\Comment' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,13 +344,14 @@ class _Wordpress extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Record Image */
|
||||
$image = NULL;
|
||||
$imagePath = $filename = NULL;
|
||||
if ( isset( $meta['_thumbnail_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$location = $this->db->select( 'meta_value', 'postmeta', array( "post_id=? AND meta_key=?", $meta['_thumbnail_id'], '_wp_attached_file' ) )->first();
|
||||
$image = rtrim( $this->app->_session['more_info']['convertCmsDatabaseRecords']['file_location'], '/' ) . '/' . $location;
|
||||
$imagePath = rtrim( $this->app->_session['more_info']['convertCmsDatabaseRecords']['file_location'], '/' ) . '/' . $location;
|
||||
$filename = basename( $imagePath );
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
}
|
||||
@@ -353,13 +364,13 @@ class _Wordpress extends \IPS\convert\Software
|
||||
'record_comments' => $row['comment_count'],
|
||||
'record_allow_comments' => 1,
|
||||
'record_saved' => new \IPS\DateTime( $row['post_date'] ),
|
||||
'record_updated' => new \IPS\DateTime( $row['post_modified'] ),
|
||||
'record_updated' => $row['post_modified'] !== '0000-00-00 00:00:00' ? new \IPS\DateTime( $row['post_modified'] ) : NULL, # Older WordPress installs may be missing a modified date
|
||||
'category_id' => $category,
|
||||
'record_approved' => $approved,
|
||||
'record_dynamic_furl' => $row['post_name'],
|
||||
'record_static_furl' => $row['post_name'],
|
||||
'record_publish_date' => new \IPS\DateTime( $row['post_date'] ),
|
||||
'record_image' => $image,
|
||||
'record_image' => $filename,
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
@@ -367,7 +378,7 @@ class _Wordpress extends \IPS\convert\Software
|
||||
2 => $row['post_content']
|
||||
);
|
||||
|
||||
$libraryClass->convertCmsDatabaseRecord( $info, $fields );
|
||||
$libraryClass->convertCmsDatabaseRecord( $info, $fields, $imagePath );
|
||||
|
||||
/* Tags */
|
||||
$tags = array();
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Xenforo Pages Converter
|
||||
*/
|
||||
class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -28,7 +31,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "XenForo Page Nodes (1.5.x/2.0.x)";
|
||||
return "XenForo Page Nodes (1.5.x/2.0.x/2.1.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Xenforo (resource manager) Pages Converter
|
||||
*/
|
||||
class _Xenfororm extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -38,14 +41,14 @@ class _Xenfororm extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "XenForo Resource Manager Articles (1.5.x/2.0.x)";
|
||||
return "XenForo Resource Manager Articles (1.5.x/2.0.x/2.1.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\convert\App The application to reference for database and other information.
|
||||
* @param bool Establish a DB connection
|
||||
* @param \IPS\convert\App $app The application to reference for database and other information.
|
||||
* @param bool $needDB Establish a DB connection
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
@@ -60,7 +63,7 @@ class _Xenfororm extends \IPS\convert\Software
|
||||
/* Is this XF1 or XF2 */
|
||||
if ( static::$isLegacy === NULL )
|
||||
{
|
||||
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( "addon_id=?", 'XF' ) )->first();
|
||||
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( \IPS\Db::i()->in( 'addon_id', array( 'XF', 'XenForo' ) ) ) )->first();
|
||||
|
||||
if ( $version < 2000010 )
|
||||
{
|
||||
@@ -310,10 +313,17 @@ class _Xenfororm extends \IPS\convert\Software
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
try
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user