Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -0,0 +1,461 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief Converter Invisioncommunnity Class
|
||||
* @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
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Blog;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
class _Invisioncommunity extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief Whether the versions of IPS4 match
|
||||
*/
|
||||
public static $versionMatch = FALSE;
|
||||
|
||||
/**
|
||||
* @brief Whether the database has been required
|
||||
*/
|
||||
public static $dbNeeded = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
/* Set filename obscuring flag */
|
||||
\IPS\convert\Library::$obscureFilenames = FALSE;
|
||||
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
if( $needDB )
|
||||
{
|
||||
static::$dbNeeded = TRUE;
|
||||
|
||||
try
|
||||
{
|
||||
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
|
||||
|
||||
/* We're matching against the human version since the long version can change with patches */
|
||||
if ( $version == \IPS\Application::load( 'core' )->version )
|
||||
{
|
||||
static::$versionMatch = TRUE;
|
||||
}
|
||||
}
|
||||
catch( \IPS\Db\Exception $e ) {}
|
||||
|
||||
/* Get parent sauce */
|
||||
$this->parent = $this->app->_parent->getSource();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareKey()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "invisioncommunity";
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires Parent
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function requiresParent()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible Parent Conversions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parents()
|
||||
{
|
||||
return array( 'core' => array( 'invisioncommunity' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
*
|
||||
* @return array|NULL
|
||||
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
|
||||
*/
|
||||
public static function canConvert()
|
||||
{
|
||||
return array(
|
||||
'convertBlogCategories' => array(
|
||||
'table' => 'blog_categories',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertBlogs' => array(
|
||||
'table' =>'blog_blogs',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertBlogEntryCategories' => array(
|
||||
'table' => 'blog_entry_categories',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertBlogEntries' => array(
|
||||
'table' => 'blog_entries',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertBlogComments' => array(
|
||||
'table' => 'blog_comments',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'core_attachments_map',
|
||||
'where' => array( \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ) )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we convert passwords from this software.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function loginEnabled()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we convert settings?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canConvertSettings()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Map
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settingsMap()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Map Listing
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settingsMapList()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
|
||||
*
|
||||
* @return string|NULL
|
||||
*/
|
||||
public static function getPreConversionInformation()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Method name
|
||||
* @return array
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertAttachments':
|
||||
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
|
||||
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
|
||||
$return[ $method ] = array(
|
||||
'upload_path' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_comments', 'class' => 'IPS\blog\Entry\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( "f_blog_entries_rebuilding", "f_entry_comments_rebuilding", "f_blogs_recounting", "f_entry_tags_cache" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix post data
|
||||
*
|
||||
* @param string raw post data
|
||||
* @return string parsed post data
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
{
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blog Categories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertBlogCategories()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'category_id' );
|
||||
foreach( $this->fetch( 'blog_categories', 'category_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'blog_categories', 'blog' );
|
||||
$row['category_name'] = $this->parent->getWord( "blog_category_{$row['category_id']}" );
|
||||
$row['category_description'] = $this->parent->getWord( "blog_category_{$row['category_id']}_desc" );
|
||||
|
||||
$libraryClass->convertBlogCategory( $row );
|
||||
$libraryClass->setLastKeyValue( $row['category_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blogs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertBlogs()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'blog_id' );
|
||||
foreach( $this->fetch( 'blog_blogs', 'blog_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'blog_blogs', 'blog' );
|
||||
$row['blog_name'] = $this->parent->getWord( "blogs_blog_{$row['blog_id']}" );
|
||||
$socialgroup = NULL;
|
||||
if ( $row['blog_social_group'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$socialgroup = iterator_to_array( $this->db->select( 'member_id', 'core_sys_social_group_members', array( "group_id=?", $row['blog_social_group'] ) ) );
|
||||
}
|
||||
catch( \UnderflowException ) { }
|
||||
}
|
||||
|
||||
$cover = NULL;
|
||||
if ( $row['blog_cover_photo'] )
|
||||
{
|
||||
$cover = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['blog_cover_photo'];
|
||||
}
|
||||
|
||||
$libraryClass->convertBlog( $row, $socialgroup, $cover );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'core_follow', array( "follow_app=? AND follow_area=? AND follow_rel_id=?", 'blog', 'blog', $row['blog_id'] ) ) AS $follow )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $follow, 'core_follow', 'core' );
|
||||
$libraryClass->convertFollow( $follow );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['blog_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blog Entry Categories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertBlogEntryCategories()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'entry_category_id' );
|
||||
foreach( $this->fetch( 'blog_entry_categories', 'entry_category_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'blog_entry_categories', 'blog' );
|
||||
$libraryClass->convertBlogEntryCategory( $row );
|
||||
$libraryClass->setLastKeyValue( $row['entry_category_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blog Entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertBlogEntries()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'entry_id' );
|
||||
foreach( $this->fetch( 'blog_entries', 'entry_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'blog_entries', 'blog' );
|
||||
|
||||
$cover = NULL;
|
||||
if ( $row['entry_cover_photo'] )
|
||||
{
|
||||
$cover = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['entry_cover_photo'];
|
||||
}
|
||||
|
||||
$libraryClass->convertBlogEntry( $row );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'core_follow', array( "follow_app=? AND follow_area=? AND follow_rel_id=?", 'blog', 'entry', $row['entry_id'] ) ) AS $follow )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $follow, 'core_follow', 'core' );
|
||||
$libraryClass->convertFollow( $follow );
|
||||
}
|
||||
|
||||
/* Tags */
|
||||
foreach( $this->db->select( '*', 'core_tags', array( "tag_meta_app=? AND tag_meta_area=? AND tag_meta_id=?", 'blog', 'blogs', $row['entry_id'] ) ) AS $tag )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $tag, 'core_tags', 'core' );
|
||||
$libraryClass->convertTag( $tag );
|
||||
}
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'core_reputation_index', array( "app=? AND type=? AND type_id=?", 'blog', 'entry_id', $row['entry_id'] ) ) AS $rep )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $rep, 'core_reputation_index', 'core' );
|
||||
$libraryClass->convertReputation( $rep );
|
||||
}
|
||||
|
||||
$libraryClass->setLasyKeyValue( $row['entry_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blog Comments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertBlogComments()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'comment_id' );
|
||||
|
||||
foreach( $this->fetch( 'blog_comments', 'comment_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'blog_comments', 'blog' );
|
||||
$libraryClass->convertBlogComment( $row );
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'core_reputation_index', array( "app=? AND type=? AND type_id=?", 'blog', 'comment_id', $row['comment_id'] ) ) AS $rep )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $rep, 'core_reputation_index', 'core' );
|
||||
$libraryClass->convertReputation( $rep );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['comment_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'attach_id' );
|
||||
|
||||
foreach( $this->fetch( 'core_attachments', 'attach_id' ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND ' . \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ), $row['attach_id'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove non-standard columns */
|
||||
$this->parent->unsetNonStandardColumns( $row, 'core_attachments', 'core' );
|
||||
$this->parent->unsetNonStandardColumns( $attachmentMap, 'core_attachments_map', 'core' );
|
||||
|
||||
/* Remap rows */
|
||||
$name = explode( '/', $row['attach_location'] );
|
||||
$row['attach_container'] = isset( $name[1] ) ? $name[0] : NULL;
|
||||
$thumbName = explode( '/', $row['attach_thumb_location'] );
|
||||
$row['attach_thumb_container'] = isset( $thumbName[1] ) ? $thumbName[0] : NULL;
|
||||
|
||||
$filePath = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['attach_location'];
|
||||
$thumbnailPath = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['attach_thumb_location'];
|
||||
|
||||
unset( $row['attach_file'] );
|
||||
|
||||
$libraryClass->convertAttachment( $row, $attachmentMap, $filePath, NULL, $thumbnailPath );
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief Converter Invisioncommunnity Class
|
||||
* @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
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Calendar;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
class _Invisioncommunity extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief Whether the versions of IPS4 match
|
||||
*/
|
||||
public static $versionMatch = FALSE;
|
||||
|
||||
/**
|
||||
* @brief Whether the database has been required
|
||||
*/
|
||||
public static $dbNeeded = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
/* Set filename obscuring flag */
|
||||
\IPS\convert\Library::$obscureFilenames = FALSE;
|
||||
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
if( $needDB )
|
||||
{
|
||||
static::$dbNeeded = TRUE;
|
||||
|
||||
try
|
||||
{
|
||||
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
|
||||
|
||||
/* We're matching against the human version since the long version can change with patches */
|
||||
if ( $version == \IPS\Application::load( 'core' )->version )
|
||||
{
|
||||
static::$versionMatch = TRUE;
|
||||
}
|
||||
}
|
||||
catch( \IPS\Db\Exception $e ) {}
|
||||
|
||||
/* Get parent sauce */
|
||||
$this->parent = $this->app->_parent->getSource();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareKey()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "invisioncommunity";
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires Parent
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function requiresParent()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible Parent Conversions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parents()
|
||||
{
|
||||
return array( 'core' => array( 'invisioncommunity' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
*
|
||||
* @return array|NULL
|
||||
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
|
||||
*/
|
||||
public static function canConvert()
|
||||
{
|
||||
return array(
|
||||
'convertCalendarCalendars' => array(
|
||||
'table' => 'calendar_calendars',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarVenues' => array(
|
||||
'table' => 'calendar_venues',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarEvents' => array(
|
||||
'table' => 'calendar_events',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarComments' => array(
|
||||
'table' => 'calendar_event_comments',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertCalendarReviews' => array(
|
||||
'table' => 'calendar_event_reviews',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarRsvps' => array(
|
||||
'table' => 'calendar_event_rsvp',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarFeeds' => array(
|
||||
'table' => 'calendar_import_feeds',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertCalendarReminders' => array(
|
||||
'table' => 'calendar_event_reminders',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'core_attachments_map',
|
||||
'where' => array( "location_key=?", 'calendar_Calendar' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we convert passwords from this software.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function loginEnabled()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we convert settings?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canConvertSettings()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Map
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settingsMap()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Map Listing
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settingsMapList()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
|
||||
*
|
||||
* @return string|NULL
|
||||
*/
|
||||
public static function getPreConversionInformation()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Method name
|
||||
* @return array
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertAttachments':
|
||||
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
|
||||
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
|
||||
$return[ $method ] = array(
|
||||
'upload_path' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_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', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_comments', 'class' => 'IPS\calendar\Event\Comment' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_reviews', 'class' => 'IPS\calendar\Event\Review' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\calendar\Event' ), 3, array( 'class' ) );
|
||||
|
||||
return array( "f_rebuild_events", "f_recount_calendar" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix post data
|
||||
*
|
||||
* @param string raw post data
|
||||
* @return string parsed post data
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
{
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarCalendars()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'cal_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_calendars', 'cal_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_calendars', 'calendar' );
|
||||
|
||||
$row['cal_title'] = $this->parent->getWord( "calendar_calendar_{$row['cal_id']}" );
|
||||
$row['cal_description'] = $this->parent->getWord( "calendar_calendar_{$row['cal_id']}_desc" );
|
||||
|
||||
$libraryClass->convertCalendar( $row );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'core_follow', array( "follow_app=? AND follow_area=? AND follow_rel_id=?", 'calendar', 'calendar', $row['cal_id'] ) ) AS $follow )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $follow, 'core_follow', 'core' );
|
||||
$libraryClass->convertFollow( $follow );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['cal_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Venues
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarVanues()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'venue_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_venues', 'venue_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_venues', 'calendar' );
|
||||
$libraryClass->convertCalendarVenue( $row );
|
||||
$libraryClass->setLastKeyValue( $row['venue_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarEvents()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'event_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_events', 'event_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_events', 'calendar' );
|
||||
|
||||
$cover = NULL;
|
||||
if ( $row['event_cover_photo'] )
|
||||
{
|
||||
$cover = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['event_cover_photo'];
|
||||
}
|
||||
|
||||
$libraryClass->convertCalendarEvent( $row, $cover );
|
||||
|
||||
/* Follows */
|
||||
foreach( $this->db->select( '*', 'core_follow', array( "follow_app=? AND follow_area=? AND follow_rel_id=?", 'calendar', 'event', $row['event_id'] ) ) AS $follow )
|
||||
{
|
||||
$this->parent->unsetnonStandardColumns( $follow, 'core_follow', 'core' );
|
||||
$libraryClass->convertFollow( $follow );
|
||||
}
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'core_reputation_index', array( "app=? AND type=? AND type_id=?", 'calendar', 'event_id', $row['event_id'] ) ) AS $rep )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $rep, 'core_reputation_index', 'core' );
|
||||
$libraryClass->convertReputation( $rep );
|
||||
}
|
||||
|
||||
/* Tags */
|
||||
foreach( $this->db->select( '*', 'core_tags', array( "tag_meta_app=? AND tag_meta_area=? AND tag_meta_id=?", 'calendar', 'calendar', $row['event_id'] ) ) AS $tag )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $tag, 'core_tags', 'core' );
|
||||
$libraryClass->convertTag( $tag );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Comments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarComments()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'comment_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_event_comments', 'comment_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_event_comments', 'calendar' );
|
||||
$libraryClass->convertCalendarComment( $row );
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'core_reputation_index', array( "app=? AND type=? AND type_id=?", 'calendar', 'comment_id', $row['comment_id'] ) ) AS $rep )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $rep, 'core_reputation_index', 'core' );
|
||||
$libraryClass->convertReputation( $rep );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['comment_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Review
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarReviews()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'review_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_event_reviews', 'review_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_event_reviews', 'calendar' );
|
||||
$libraryClass->convertCalendarReview( $row );
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'core_reputation_index', array( "app=? AND type=? AND type_id=?", 'calendar', 'review_id', $row['review_id'] ) ) AS $rep )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $rep, 'core_reputation_index', 'core' );
|
||||
$libraryClass->convertReputation( $rep );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['review_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Reminders
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarReminders()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'reminder_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_event_reminders', 'reminder_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_event_reviews', 'calendar' );
|
||||
$libraryClass->convertCalendarReminder( $row );
|
||||
$libraryClass->setLastKeyValue( $row['reminder_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar RSVPs
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function convertCalendarRsvps()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'rsvp_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_event_rsvp', 'rsvp_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_event_rsvp', 'calendar' );
|
||||
$libraryClass->convertCalendarRsvp( $row );
|
||||
$libraryClass->setLastKeyValue( $row['rsvp_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Calendar Feeds
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCalendarFeeds()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'feed_id' );
|
||||
|
||||
foreach( $this->fetch( 'calendar_import_feeds', 'feed_id' ) AS $row )
|
||||
{
|
||||
$this->parent->unsetNonStandardColumns( $row, 'calendar_import_feeds', 'calendar' );
|
||||
$libraryClass->convertCalendarFeed( $row );
|
||||
$libraryClass->setLastKeyValue( $row['feed_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'attach_id' );
|
||||
|
||||
foreach( $this->fetch( 'core_attachments', 'attach_id' ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND location_key=?', $row['attach_id'], 'calendar_Calendar' ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove non-standard columns */
|
||||
$this->parent->unsetNonStandardColumns( $row, 'core_attachments', 'core' );
|
||||
$this->parent->unsetNonStandardColumns( $attachmentMap, 'core_attachments_map', 'core' );
|
||||
|
||||
/* Remap rows */
|
||||
$name = explode( '/', $row['attach_location'] );
|
||||
$row['attach_container'] = isset( $name[1] ) ? $name[0] : NULL;
|
||||
$thumbName = explode( '/', $row['attach_thumb_location'] );
|
||||
$row['attach_thumb_container'] = isset( $thumbName[1] ) ? $thumbName[0] : NULL;
|
||||
|
||||
$filePath = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['attach_location'];
|
||||
$thumbnailPath = $this->app->_session['more_info']['convertAttachments']['upload_path'] . '/' . $row['attach_thumb_location'];
|
||||
|
||||
unset( $row['attach_file'] );
|
||||
|
||||
$libraryClass->convertAttachment( $row, $attachmentMap, $filePath, NULL, $thumbnailPath );
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class _Wordpress extends \IPS\convert\Software
|
||||
'table' => 'comments',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertCmsMedia' => array(
|
||||
'convertAttachments' => array(
|
||||
'table' => 'posts',
|
||||
'where' => array( "post_type=?", 'attachment' )
|
||||
)
|
||||
@@ -131,7 +131,7 @@ class _Wordpress extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertCmsMedia',
|
||||
'convertAttachments',
|
||||
'convertCmsDatabaseRecords'
|
||||
);
|
||||
}
|
||||
@@ -159,8 +159,8 @@ class _Wordpress extends \IPS\convert\Software
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertCmsMedia':
|
||||
$return['convertCmsMedia']['file_location'] = array(
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments']['file_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_required' => TRUE,
|
||||
'field_default' => NULL,
|
||||
@@ -464,46 +464,99 @@ class _Wordpress extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
protected $postContent = [];
|
||||
|
||||
/**
|
||||
* Convert CMS media
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertCmsMedia()
|
||||
public function convertAttachments()
|
||||
{
|
||||
$database = $this->app->getLink( 1, 'cms_databases' );
|
||||
$contentField = $this->app->getLink( 2, 'cms_database_fields' );
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'ID' );
|
||||
|
||||
foreach( $this->fetch( 'posts', 'ID', array( "post_type=?", 'attachment' ) ) AS $row )
|
||||
{
|
||||
$meta = array();
|
||||
foreach( $this->db->select( '*', 'postmeta', array( "post_id=?", $row['ID'] ) ) AS $m )
|
||||
{
|
||||
$meta[$m['meta_key']] = $m['meta_value'];
|
||||
}
|
||||
|
||||
/* No filename, no convert */
|
||||
if( !isset( $meta['_wp_attached_file'] ) )
|
||||
$data = iterator_to_array( $this->fetch( 'posts', 'ID', [ 'post_type=?', 'attachment' ] ) );
|
||||
$this->app->preCacheLinks( $data, [ 'core_members' => 'post_author' ] );
|
||||
|
||||
foreach( $data AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->db->select( '*', 'postmeta', [ 'meta_key=? AND meta_value=?', '_thumbnail_id', $row['ID'] ] )->first();
|
||||
$libraryClass->setLastKeyValue( $row['ID'] );
|
||||
continue;
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
try
|
||||
{
|
||||
$wpPost = $this->db->select( '*', 'posts', [ 'ID=? AND post_type=?', $row['post_parent'], 'post' ] )->first();
|
||||
$postId = $this->app->getLink( $wpPost['ID'], "cms_custom_database_" . $database );
|
||||
if( !isset( $this->postContent[ $postId ] ) )
|
||||
{
|
||||
$this->postContent[ $postId ] = \IPS\Db::i()->select( 'field_' . $contentField, 'cms_custom_database_' . $database, array( "primary_id_field=?", $postId ) )->first();
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException | \OutOfRangeException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['ID'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$filename = explode( '/', $meta['_wp_attached_file'] );
|
||||
$filename = array_pop( $filename );
|
||||
|
||||
$path = rtrim( $this->app->_session['more_info']['convertCmsMedia']['file_location'], '/' );
|
||||
|
||||
|
||||
/* Post Meta */
|
||||
$meta = array();
|
||||
foreach( $this->db->select( '*', 'postmeta', array( "post_id=?", $row['ID'] ) ) AS $m )
|
||||
{
|
||||
$meta[ $m['meta_key'] ] = $m['meta_value'];
|
||||
}
|
||||
|
||||
$map = [
|
||||
'id1' => $wpPost['ID'],
|
||||
'id2' => 2,
|
||||
'id2_type' => 'cms_database_fields',
|
||||
'id3' => 1
|
||||
];
|
||||
|
||||
$info = array(
|
||||
'media_id' => $row['ID'],
|
||||
'media_filename' => $filename,
|
||||
'media_added' => new \IPS\DateTime( $row['post_date'] ),
|
||||
'attach_id' => $row['ID'],
|
||||
'attach_file' => basename( $meta['_wp_attached_file'] ),
|
||||
'attach_date' => new \IPS\DateTime( $row['post_date'] ),
|
||||
'attach_member_id' => $row['post_author']
|
||||
);
|
||||
|
||||
$libraryClass->convertCmsMedia( $info, $path . '/' . $meta['_wp_attached_file'] );
|
||||
|
||||
|
||||
$attachId = $libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $meta['_wp_attached_file'] );
|
||||
|
||||
if( $attachId !== FALSE AND mb_stristr( $this->postContent[ $postId ], $meta['_wp_attached_file'] ) )
|
||||
{
|
||||
$dom = new \IPS\Xml\DOMDocument( '1.0', 'UTF-8' );
|
||||
$dom->loadHTML( \IPS\Xml\DOMDocument::wrapHtml( $this->postContent[ $postId ] ) );
|
||||
$xPath = new \DOMXPath( $dom );
|
||||
|
||||
foreach ( $xPath->query( "//img[contains(@src, '" . $meta['_wp_attached_file'] ."')] | //a[contains(@href, '" . $meta['_wp_attached_file'] ."')]" ) as $tag )
|
||||
{
|
||||
$text = $dom->createTextNode( '[attachment=' . $attachId . ':name]' );
|
||||
$tag->parentNode->replaceChild( $text, $tag );
|
||||
}
|
||||
|
||||
/* Get DOMDocument output */
|
||||
$content = \IPS\Text\DOMParser::getDocumentBodyContents( $dom );
|
||||
|
||||
/* Replace file storage tags */
|
||||
$content = preg_replace( '/<fileStore\.([\d\w\_]+?)>/i', '<fileStore.$1>', $content );
|
||||
|
||||
/* DOMDocument::saveHTML will encode the base_url brackets, so we need to make sure it's in the expected format. */
|
||||
$this->postContent[ $postId ] = str_replace( '<___base_url___>', '<___base_url___>', $content );
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['ID'] );
|
||||
}
|
||||
|
||||
/* Do the updates */
|
||||
foreach( $this->postContent as $pid => $content )
|
||||
{
|
||||
\IPS\Db::i()->update( 'cms_custom_database_' . $database, array( 'field_' . $contentField => $content ), array( 'primary_id_field=?', $pid ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()-uid, array( 'members', 'core_members' ) );
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()->uid, array( 'members', 'core_members' ) );
|
||||
return \IPS\Member::load( $data )->url();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
|
||||
@@ -31,7 +31,7 @@ class _Wordpress extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "WordPress (5.x)";
|
||||
return "WordPress (5.x/6.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,6 +237,9 @@ class _Wordpress extends \IPS\convert\Software
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* Attachments */
|
||||
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
|
||||
|
||||
/* Content Counts */
|
||||
\IPS\Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
|
||||
@@ -330,21 +330,23 @@ class _Smf extends \IPS\convert\Software
|
||||
$poll_data = $this->db->select( '*', 'polls', array( "id_poll=?", $row['id_poll'] ) )->first();
|
||||
|
||||
$options = $this->db->select( '*', 'poll_choices', array( "id_poll=?", $poll_data['id_poll'] ) );
|
||||
|
||||
$choices = array();
|
||||
$votes = 0;
|
||||
|
||||
$choices = $votes = $search = [];
|
||||
$index = 1;
|
||||
foreach( $options AS $option )
|
||||
{
|
||||
$choices[ $option['id_choice'] ] = $option['label'];
|
||||
$votes += $option['votes'];
|
||||
$choices[ $index ] = $option['label'];
|
||||
$votes[ $index ] = $option['votes'];
|
||||
$search[ $index ] = $option['id_choice'];
|
||||
$index++;
|
||||
}
|
||||
|
||||
$member_votes = array();
|
||||
foreach( $this->db->select( '*', 'log_polls', array( "id_poll=?", $poll_data['id_poll'] ) ) AS $vote )
|
||||
{
|
||||
$member_votes[$vote['id_member']] = array(
|
||||
$member_votes[ $vote['id_member'] ] = array(
|
||||
'member_id' => $vote['id_member'],
|
||||
'member_choices' => array( $vote['id_choice'] )
|
||||
'member_choices' => array( 1 => array_search( $vote['id_choice'], $search ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
public function finish()
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\forums\Topic' ), 2, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'forums_posts', 'class' => 'IPS\forums\Topic\Post' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
|
||||
Reference in new issue
Block a user