Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -28,7 +28,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "Coppermine";
|
||||
return "Coppermine (phpBB 3.1.x/3.2.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,6 +144,7 @@ class _Coppermine extends \IPS\convert\Software
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
@@ -111,6 +111,7 @@ class _Photoplog extends \IPS\convert\Software
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
@@ -29,7 +29,7 @@ class _Photopost extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "Photopost";
|
||||
return "Photopost (8.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,6 +43,26 @@ class _Photopost extends \IPS\convert\Software
|
||||
return "photopost";
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires Parent
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function requiresParent()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible Parent Conversions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parents()
|
||||
{
|
||||
return array( 'core' => array( 'photopost' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
*
|
||||
@@ -50,7 +70,226 @@ class _Photopost extends \IPS\convert\Software
|
||||
*/
|
||||
public static function canConvert()
|
||||
{
|
||||
return NULL;
|
||||
return array(
|
||||
'convertGalleryCategories' => array(
|
||||
'table' => 'categories',
|
||||
'where' => array( 'cattype=?', 'c' )
|
||||
),
|
||||
'convertGalleryAlbums' => array(
|
||||
'table' => 'categories',
|
||||
'where' => array( 'cattype=?', 'a' )
|
||||
),
|
||||
'convertGalleryImages' => array(
|
||||
'table' => 'photos',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertGalleryComments' => array(
|
||||
'table' => 'comments',
|
||||
'where' => NULL,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertGalleryAlbums',
|
||||
'convertGalleryImages'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Conversion method
|
||||
* @return array
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
{
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertGalleryAlbums':
|
||||
$options = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'gallery_categories' ), 'IPS\gallery\Category' ) AS $category )
|
||||
{
|
||||
$options[$category->_id] = $category->_title;
|
||||
}
|
||||
|
||||
$return['convertGalleryAlbums']['members_gallery_category'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Select',
|
||||
'field_default' => NULL,
|
||||
'field_required' => FALSE,
|
||||
'field_extra' => array(
|
||||
'options' => $options
|
||||
),
|
||||
'field_hint' => NULL,
|
||||
);
|
||||
break;
|
||||
case 'convertGalleryImages':
|
||||
$return['convertGalleryImages']['file_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_photopost_image_path'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish - Adds everything it needs to the queues and clears data store
|
||||
*
|
||||
* @return array Messages to display
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
return array( "f_gallery_images_rebuild", "f_gallery_cat_recount", "f_gallery_album_recount", "f_gallery_image_recount" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert gallery categories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryCategories()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id' );
|
||||
|
||||
foreach( $this->fetch( 'categories', 'id', array( 'cattype=?', 'c' ) ) AS $row )
|
||||
{
|
||||
$libraryClass->convertGalleryCategory( array(
|
||||
'category_id' => $row['id'],
|
||||
'category_name' => html_entity_decode( $row['catname'] ),
|
||||
'category_desc' => $row['description'],
|
||||
'category_parent_id' => $row['parent'],
|
||||
'category_count_imgs' => $row['photos'],
|
||||
'category_position' => $row['catorder']
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert gallery albums
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryAlbums()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id' );
|
||||
|
||||
foreach( $this->fetch( 'categories', 'id', array( 'cattype=?', 'a' ) ) AS $row )
|
||||
{
|
||||
$info = array(
|
||||
'album_id' => $row['id'],
|
||||
'album_owner_id' => $row['parent'],
|
||||
'album_description' => $row['description'],
|
||||
'album_name' => $row['catname'],
|
||||
'album_type' => $row['private'] == 'yes' ? 2 : 1,
|
||||
'album_count_imgs' => $row['photos'],
|
||||
'album_count_comments' => $row['posts']
|
||||
);
|
||||
|
||||
$category = $this->app->_session['more_info']['convertGalleryAlbums']['members_gallery_category'];
|
||||
if ( $category == 0 )
|
||||
{
|
||||
$category = NULL;
|
||||
}
|
||||
|
||||
$libraryClass->convertGalleryAlbum( $info, NULL, $category );
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert gallery images
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryImages()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id' );
|
||||
|
||||
foreach( $this->fetch( 'photos', 'id' ) AS $row )
|
||||
{
|
||||
$info = array(
|
||||
'image_id' => $row['id'],
|
||||
'image_album_id' => $row['cat'],
|
||||
'image_category_id' => $row['cat'],
|
||||
'image_member_id' => $row['userid'],
|
||||
'image_caption' => $row['title'],
|
||||
'image_description' => $row['description'],
|
||||
'image_views' => $row['views'],
|
||||
'image_comments' => $row['numcom'],
|
||||
'image_ratings_total' => $row['rating'] * $row['votes'],
|
||||
'image_ratings_count' => $row['votes'],
|
||||
'image_rating' => $row['rating'],
|
||||
'image_date' => $row['date'],
|
||||
'image_last_comment' => $row['lastpost'],
|
||||
'image_ipaddress' => $row['ipaddress'],
|
||||
'image_approved' => $row['approved'],
|
||||
'image_file_name' => $row['bigimage']
|
||||
);
|
||||
|
||||
$directory = $row['storecat'] ?: $row['cat'];
|
||||
$path = rtrim( $this->app->_session['more_info']['convertGalleryImages']['file_location'], '/' ) . '/' . $directory . '/' . $row['bigimage'];
|
||||
|
||||
$libraryClass->convertGalleryImage( $info, $path );
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert gallery comments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryComments()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id' );
|
||||
|
||||
foreach( $this->fetch( 'comments', 'id' ) AS $row )
|
||||
{
|
||||
$libraryClass->convertGalleryComment( array(
|
||||
'comment_id' => $row['id'],
|
||||
'comment_text' => $row['comment'],
|
||||
'comment_img_id' => $row['photo'],
|
||||
'comment_author_id' => $row['userid'],
|
||||
'comment_author_name' => $row['username'],
|
||||
'comment_ip_address' => $row['ipaddress'],
|
||||
'comment_post_date' => $row['date'],
|
||||
'comment_approved' => $row['approved'],
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -157,6 +157,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
@@ -295,13 +296,24 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$filepath = rtrim( $this->app->_session['more_info']['convertGalleryImages']['file_location'], '/' ) . '/' . $filepath . '/' . $image['pictureid'] . '.picture';
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$albumAndDate = $this->db->select( 'albumid, dateline', 'albumpicture', array( "pictureid=?", $image['pictureid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* Orphaned */
|
||||
$libraryClass->setLastKeyValue( $image['pictureid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'image_id' => $image['pictureid'],
|
||||
'image_album_id' => $this->db->select( 'albumid', 'albumpicture', array( "pictureid=?", $image['pictureid'] ) )->first(),
|
||||
'image_album_id' => $albumAndDate['albumid'],
|
||||
'image_member_id' => $image['userid'],
|
||||
'image_caption' => $image['caption'],
|
||||
'image_file_name' => $image['caption'] . '.' . $image['extension'],
|
||||
'image_date' => $this->db->select( 'dateline', 'albumpicture', array( "pictureid=?", $image['pictureid'] ) )->first(),
|
||||
'image_date' => $albumAndDate['dateline'],
|
||||
);
|
||||
|
||||
$libraryClass->convertGalleryImage( $info, $filepath, $filedata );
|
||||
@@ -436,7 +448,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$data = $this->app->getLink( \IPS\Request::i()->albumid, 'gallery_albums' );
|
||||
$item = \IPS\gallery\Album::load( $data );
|
||||
|
||||
if( $item->canView() )
|
||||
if( $item->can( 'view' ) )
|
||||
{
|
||||
return $item->url();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,54 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
|
||||
*/
|
||||
public static $isLegacy = NULL;
|
||||
|
||||
/**
|
||||
* @brief XF2 Has prefixes on RM tables
|
||||
*/
|
||||
public static $tablePrefix = 'xengallery_';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\convert\App The application to reference for database and other information.
|
||||
* @param bool Establish a DB connection
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
if ( $needDB )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Is this XF1 or XF2 */
|
||||
if ( static::$isLegacy === NULL )
|
||||
{
|
||||
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( "addon_id=?", 'XF' ) )->first();
|
||||
|
||||
if ( $version < 2000010 )
|
||||
{
|
||||
static::$isLegacy = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
static::$tablePrefix = 'xf_mg_';
|
||||
static::$isLegacy = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
@@ -28,7 +76,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "XenForo Media Gallery";
|
||||
return "XenForo Media Gallery (1.5.x/2.0.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,24 +99,56 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
return array(
|
||||
'convertGalleryCategories' => array(
|
||||
'table' => 'xengallery_category',
|
||||
'table' => static::$tablePrefix . 'category',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertGalleryAlbums' => array(
|
||||
'table' => 'xengallery_album',
|
||||
'table' => static::$tablePrefix . 'album',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertGalleryImages' => array(
|
||||
'table' => 'xengallery_media',
|
||||
'table' => ( static::$isLegacy ? 'xengallery_media' : 'xf_mg_media_item' ),
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertGalleryComments' => array(
|
||||
'table' => 'xengallery_comment',
|
||||
'table' => static::$tablePrefix . 'comment',
|
||||
'where' => NULL,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Source Rows for a specific step
|
||||
*
|
||||
* @param string $table The table containing the rows to count.
|
||||
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
|
||||
* @param bool $recache Skip cache and pull directly (updating cache)
|
||||
* @return integer
|
||||
* @throws \IPS\convert\Exception
|
||||
*/
|
||||
public function countRows( $table, $where=NULL, $recache=FALSE )
|
||||
{
|
||||
switch( $table )
|
||||
{
|
||||
case 'xengallery_category':
|
||||
/* We need to do this for the connection check because all tables have different names in XF2 */
|
||||
if( $this->db->checkForTable( 'xengallery_category' ) )
|
||||
{
|
||||
return $this->db->select( 'COUNT(*)', 'xengallery_category' )->first();
|
||||
}
|
||||
elseif( $this->db->checkForTable( 'xf_mg_category' ) )
|
||||
{
|
||||
return $this->db->select( 'COUNT(*)', 'xf_mg_category' )->first();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses Prefix
|
||||
*
|
||||
@@ -190,6 +270,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
@@ -203,13 +284,15 @@ class _Xenforo extends \IPS\convert\Software
|
||||
/**
|
||||
* Helper to fetch a xenforo phrase
|
||||
*
|
||||
* @param string $title Phrase
|
||||
* @param string $xfOneTitle XF1 Phrase title
|
||||
* @param string $xfTwoTitle XF2 Phrase Title
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getPhrase( $title )
|
||||
protected function getPhrase( $xfOneTitle, $xfTwoTitle )
|
||||
{
|
||||
try
|
||||
{
|
||||
$title = ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
|
||||
return $this->db->select( 'phrase_text', 'xf_phrase', array( "title=?", $title ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
@@ -229,19 +312,19 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'category_id' );
|
||||
|
||||
foreach( $this->fetch( 'xengallery_category', 'category_id' ) AS $row )
|
||||
foreach( $this->fetch( static::$tablePrefix . 'category', 'category_id' ) AS $row )
|
||||
{
|
||||
$libraryClass->convertGalleryCategory( array(
|
||||
'category_id' => $row['category_id'],
|
||||
'category_name' => $row['category_title'],
|
||||
'category_desc' => $row['category_description'],
|
||||
'category_name' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
|
||||
'category_desc' => isset( $row['category_description'] ) ? $row['category_description'] : $row['description'],
|
||||
'category_parent_id' => $row['parent_category_id'],
|
||||
'category_count_imgs' => $row['category_media_count'],
|
||||
'category_count_imgs' => isset( $row['category_media_count'] ) ? $row['category_media_count'] : $row['category_media_count'],
|
||||
'category_position' => $row['display_order']
|
||||
) );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'xengallery_category_watch', array( "notify_on=? AND category_id=?", 'media', $row['category_id'] ) ) AS $follow )
|
||||
foreach( $this->db->select( '*', static::$tablePrefix . 'category_watch', array( "notify_on=? AND category_id=?", 'media', $row['category_id'] ) ) AS $follow )
|
||||
{
|
||||
$libraryClass->convertFollow( array(
|
||||
'follow_app' => 'gallery',
|
||||
@@ -256,7 +339,6 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'follow_notify_freq' => ( $follow['send_alert'] OR $follow['send_email'] ) ? 'immediate' : 'none',
|
||||
'follow_notify_sent' => 0,
|
||||
'follow_visible' => 1,
|
||||
'follow_index_id' => NULL
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -273,20 +355,32 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'album_id' );
|
||||
|
||||
foreach( $this->fetch( 'xengallery_album', 'album_id' ) AS $row )
|
||||
foreach( $this->fetch( static::$tablePrefix . 'album', 'album_id' ) AS $row )
|
||||
{
|
||||
try
|
||||
if( static::$isLegacy )
|
||||
{
|
||||
$perm = $this->db->select( '*', 'xengallery_album_permission', array( "album_id=? AND permission=?", $row['album_id'], 'view' ) )->first();
|
||||
try
|
||||
{
|
||||
$perm = $this->db->select( '*', 'xengallery_album_permission', array( "album_id=? AND permission=?", $row['album_id'], 'view' ) )->first();
|
||||
$perm['share_users'] = \unserialize( $perm['share_users'] );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* If the permission row is missing for some reason, err on the side of caution and set this album private */
|
||||
$perm = array(
|
||||
'album_id' => $row['album_id'],
|
||||
'permission' => 'view',
|
||||
'access_type' => 'private',
|
||||
'share_users' => array()
|
||||
);
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
/* XF2 */
|
||||
else
|
||||
{
|
||||
/* If the permission row is missing for some reason, err on the side of caution and set this album private */
|
||||
$perm = array(
|
||||
'album_id' => $row['album_id'],
|
||||
'permission' => 'view',
|
||||
'access_type' => 'private',
|
||||
'share_users' => \serialize( array() ),
|
||||
'access_type' => $row['view_privacy'],
|
||||
'share_users' => json_decode( $row['view_users'], TRUE )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -297,7 +391,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/* Specific members */
|
||||
case 'shared':
|
||||
$users = \unserialize( $perm['share_users'] );
|
||||
$users = $perm['share_users'];
|
||||
$socialgroup['members'] = array();
|
||||
|
||||
if ( count( $users ) )
|
||||
@@ -340,14 +434,14 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$info = array(
|
||||
'album_id' => $row['album_id'],
|
||||
'album_owner_id' => $row['album_user_id'],
|
||||
'album_description' => $row['album_description'],
|
||||
'album_name' => $row['album_title'],
|
||||
'album_description' => isset( $row['album_description'] ) ? $row['album_description'] : $row['description'],
|
||||
'album_name' => isset( $row['album_title'] ) ? $row['album_title'] : $row['title'],
|
||||
'album_type' => $type,
|
||||
'album_count_imgs' => $row['album_media_count'],
|
||||
'album_count_comments' => $row['album_comment_count'],
|
||||
'album_rating_aggregate' => $row['album_rating_avg'],
|
||||
'album_rating_count' => $row['album_rating_count'],
|
||||
'album_rating_total' => $row['album_rating_sum'],
|
||||
'album_count_imgs' => isset( $row['album_media_count'] ) ? $row['album_media_count'] : $row['media_count'],
|
||||
'album_count_comments' => isset( $row['album_comment_count'] ) ? $row['album_comment_count'] : $row['comment_count'],
|
||||
'album_rating_aggregate' => isset( $row['album_rating_avg'] ) ? $row['album_rating_avg'] : $row['rating_avg'],
|
||||
'album_rating_count' => isset( $row['album_rating_count'] ) ? $row['album_rating_count'] : $row['rating_count'],
|
||||
'album_rating_total' => isset( $row['album_rating_sum'] ) ? $row['album_rating_sum'] : $row['ating_sum'],
|
||||
);
|
||||
|
||||
$category = $this->app->_session['more_info']['convertGalleryAlbums']['members_gallery_category'];
|
||||
@@ -359,7 +453,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$libraryClass->convertGalleryAlbum( $info, $socialgroup, $category );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'xengallery_album_watch', array( "notify_on=? AND album_id=?", 'media', $row['album_id'] ) ) AS $follow )
|
||||
foreach( $this->db->select( '*', static::$tablePrefix . 'album_watch', array( "notify_on=? AND album_id=?", 'media', $row['album_id'] ) ) AS $follow )
|
||||
{
|
||||
$libraryClass->convertFollow( array(
|
||||
'follow_app' => 'gallery',
|
||||
@@ -374,7 +468,6 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'follow_notify_freq' => ( $follow['send_alert'] OR $follow['send_email'] ) ? 'immediate' : 'none',
|
||||
'follow_notify_sent' => 0,
|
||||
'follow_visible' => 1,
|
||||
'follow_index_id' => NULL
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -393,13 +486,27 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'media_id' );
|
||||
|
||||
foreach( $this->fetch( 'xengallery_media', 'media_id' ) AS $row )
|
||||
foreach( $this->fetch( static::$isLegacy ? 'xf_gallery_media' : 'xf_mg_media_item', 'media_id' ) AS $row )
|
||||
{
|
||||
/* Exif */
|
||||
$exif = array();
|
||||
foreach( $this->db->select( 'exif_name, exif_value', 'xengallery_exif', array( "media_id=?", $row['media_id'] ) )->setKeyField( 'exif_name' )->setValueField( 'exif_value' ) AS $key => $value )
|
||||
if( static::$isLegacy )
|
||||
{
|
||||
$exif[$key] = $value;
|
||||
foreach( $this->db->select( 'exif_name, exif_value', 'xengallery_exif', array( "media_id=?", $row['media_id'] ) )->setKeyField( 'exif_name' )->setValueField( 'exif_value' ) AS $key => $value )
|
||||
{
|
||||
$exif[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
/* XF2 */
|
||||
else
|
||||
{
|
||||
foreach( json_decode( $row['exif_data'], TRUE ) AS $key => $value )
|
||||
{
|
||||
foreach( $value as $subKey => $subValue )
|
||||
{
|
||||
$exif[ $key . '.' . $subKey ] = $subValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IP Address */
|
||||
@@ -417,9 +524,10 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/* Normal image upload */
|
||||
case 'image_upload':
|
||||
case 'image':
|
||||
try
|
||||
{
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'xengallery_media', $row['media_id'] ) )
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", ( static::$isLegacy ? 'xengallery_media' : 'xfmg_media' ), $row['media_id'] ) )
|
||||
->join( 'xf_attachment_data', 'xf_attachment.data_id = xf_attachment_data.data_id' )
|
||||
->first();
|
||||
}
|
||||
@@ -433,15 +541,17 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertGalleryImages']['file_location'], '/' ) . '/' . $group . '/' . $file_data['data_id'] . '-' . $file_data['file_hash'] . '.data';
|
||||
$file_name = $file_data['filename'];
|
||||
$description = $row['media_description'];
|
||||
$description = isset( $row['media_description'] ) ? $row['media_description'] : $row['description'];
|
||||
|
||||
break;
|
||||
|
||||
/* Video Embed */
|
||||
case 'video_embed':
|
||||
case 'embed':
|
||||
$path = $this->app->_session['more_info']['convertGalleryImages']['media_thumb_location'];
|
||||
|
||||
/* We need to figure out what service we came from, and the video ID */
|
||||
$matches = array();
|
||||
preg_match( '/\[media=(.*?)\](.*?)\[\/media\]/i', $row['media_tag'], $matches );
|
||||
$service = $matches[1];
|
||||
$video_id = $matches[2];
|
||||
@@ -460,7 +570,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$description = $em . "<br>" . $row['media_description'];
|
||||
$description = $em . "<br>" . isset( $row['media_description'] ) ? $row['media_description'] : $row['description'];
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -470,8 +580,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'image_album_id' => $row['album_id'],
|
||||
'image_category_id' => $row['category_id'],
|
||||
'image_member_id' => $row['user_id'],
|
||||
'image_caption' => $row['media_title'],
|
||||
'image_views' => $row['media_view_count'],
|
||||
'image_caption' => isset( $row['media_title'] ) ? $row['media_title'] : $row['title'],
|
||||
'image_views' => isset( $row['media_view_count'] ) ? $row['media_view_count'] : $row['view_count'],
|
||||
'image_comments' => $row['comment_count'],
|
||||
'image_ratings_total' => $row['rating_sum'],
|
||||
'image_ratings_count' => $row['rating_count'],
|
||||
@@ -488,9 +598,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$libraryClass->convertGalleryImage( $info, $path );
|
||||
|
||||
/* Warnings */
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND content_id=?", 'xengallery_media', $row['media_id'] ) ) AS $warn )
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND content_id=?", ( static::$isLegacy ? 'xengallery_media' : 'xfmg_media' ), $row['media_id'] ) ) AS $warn )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $warn['warning_user_id'],
|
||||
@@ -499,6 +609,17 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'wl_note_member' => $warn['title'],
|
||||
'wl_note_mods' => $warn['notes'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['warning_id'],
|
||||
'log_member' => $warn['user_id'],
|
||||
'log_by' => $warn['warning_user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['warning_date']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* Reputation */
|
||||
@@ -520,7 +641,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'xengallery_media_watch', array( "media_id=?", $row['media_id'] ) ) AS $follow )
|
||||
foreach( $this->db->select( '*', static::$tablePrefix . 'media_watch', array( "media_id=?", $row['media_id'] ) ) AS $follow )
|
||||
{
|
||||
$libraryClass->convertFollow( array(
|
||||
'follow_app' => 'gallery',
|
||||
@@ -535,7 +656,6 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'follow_notify_freq' => ( $follow['send_alert'] OR $follow['send_email'] ) ? 'immediate' : 'none',
|
||||
'follow_notify_sent' => 0,
|
||||
'follow_visible' => 1,
|
||||
'follow_index_id' => NULL
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -582,7 +702,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'comment_id' );
|
||||
|
||||
foreach( $this->fetch( 'xengallery_comment', 'comment_id', array( "content_type=?", 'media' ) ) AS $row )
|
||||
foreach( $this->fetch( static::$tablePrefix . 'comment', 'comment_id', array( "content_type=?", 'media' ) ) AS $row )
|
||||
{
|
||||
/* IP Address */
|
||||
try
|
||||
@@ -640,9 +760,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Warnings */
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND content_id=?", 'xengallery_comment', $row['comment_id'] ) ) AS $warn )
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND content_id=?", ( static::$isLegacy ? 'xengallery_comment' : 'xfmg_comment' ), $row['comment_id'] ) ) AS $warn )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $warn['warning_user_id'],
|
||||
@@ -651,6 +771,17 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'wl_note_member' => $warn['title'],
|
||||
'wl_note_mods' => $warn['notes'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['warning_id'],
|
||||
'log_member' => $warn['user_id'],
|
||||
'log_by' => $warn['warning_user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['warning_date']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['comment_id'] );
|
||||
|
||||
Reference in new issue
Block a user