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,23 @@
|
||||
* @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\Library;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invision Calendar Converter
|
||||
* @note We must extend the Core Library here so we can access methods like convertAttachment, convertFollow, etc
|
||||
*/
|
||||
class _Calendar extends Core
|
||||
{
|
||||
/**
|
||||
@@ -34,6 +38,7 @@ class _Calendar extends Core
|
||||
public function menuRows( $rowCounts=FALSE )
|
||||
{
|
||||
$return = array();
|
||||
$extraRows = $this->software->extraMenuRows();
|
||||
|
||||
foreach( $this->getConvertableItems() as $k => $v )
|
||||
{
|
||||
@@ -45,7 +50,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarCalendars',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_calendars' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'calendar_calendars',
|
||||
);
|
||||
@@ -57,7 +62,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarVenues',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_venues' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
'link_type' => 'calendar_venues',
|
||||
);
|
||||
@@ -69,7 +74,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarEvents',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_events' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 1500,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
'link_type' => 'calendar_events',
|
||||
'requires_rebuild' => TRUE
|
||||
@@ -82,7 +87,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarComments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_comments' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'calendar_event_comments',
|
||||
'requires_rebuild' => TRUE
|
||||
@@ -95,7 +100,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarReviews',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reviews' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'calendar_event_reviews',
|
||||
'requires_rebuild' => TRUE
|
||||
@@ -108,7 +113,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarRsvps',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_rsvp' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'calendar_event_rsvp',
|
||||
);
|
||||
@@ -120,7 +125,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarFeeds',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_import_feeds' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
'link_type' => 'calendar_import_feeds',
|
||||
);
|
||||
@@ -132,7 +137,7 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertCalendarReminders',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'calendar_reminders',
|
||||
);
|
||||
@@ -144,15 +149,22 @@ class _Calendar extends Core
|
||||
'step_method' => 'convertAttachments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'calendar_Calendar' ) ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'per_cycle' => 10,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'core_attachments',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$return = $this->software->extraMenuRows( $return );
|
||||
/* Append any extra steps immediately to retain ordering */
|
||||
if( isset( $v['extra_steps'] ) )
|
||||
{
|
||||
foreach( $v['extra_steps'] as $extra )
|
||||
{
|
||||
$return[ $extra ] = $extraRows[ $extra ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Run the queries if we want row counts */
|
||||
if( $rowCounts )
|
||||
@@ -166,12 +178,13 @@ class _Calendar extends Core
|
||||
/**
|
||||
* Returns an array of tables that need to be truncated when Empty Local Data is used
|
||||
*
|
||||
* @param string $method Method to truncate
|
||||
* @return array
|
||||
*/
|
||||
protected function truncate( $method )
|
||||
{
|
||||
$return = array();
|
||||
$classname = get_class( $this->software );
|
||||
$classname = \get_class( $this->software );
|
||||
|
||||
if( $classname::canConvert() === NULL )
|
||||
{
|
||||
@@ -465,7 +478,7 @@ class _Calendar extends Core
|
||||
if ( isset( $info['event_recurring'] ) )
|
||||
{
|
||||
/* If we have an array, pass off to ICSParser so we can build it */
|
||||
if ( is_array( $info['event_recurring'] ) )
|
||||
if ( \is_array( $info['event_recurring'] ) )
|
||||
{
|
||||
$info['event_recurring'] = \IPS\calendar\Icalendar\ICSParser::buildRrule( $info['event_recurring'] );
|
||||
}
|
||||
@@ -588,7 +601,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['event_location'] ) )
|
||||
{
|
||||
if ( is_array( $info['event_location'] ) AND isset( $info['event_location']['lat'] ) AND isset( $info['event_location']['long'] ) )
|
||||
if ( \is_array( $info['event_location'] ) AND isset( $info['event_location']['lat'] ) AND isset( $info['event_location']['long'] ) )
|
||||
{
|
||||
$info['event_location'] = (string) \IPS\GeoLocation::getFromLatLong( $info['event_location']['lat'], $info['event_location']['long'] );
|
||||
}
|
||||
@@ -623,11 +636,11 @@ class _Calendar extends Core
|
||||
$info['event_album'] = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $info['event_cover_photo'] ) AND ( !is_null( $filepath ) OR !is_null( $filedata ) ) )
|
||||
if ( isset( $info['event_cover_photo'] ) AND ( !\is_null( $filepath ) OR !\is_null( $filedata ) ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( is_null( $filedata ) AND !is_null( $filepath ) )
|
||||
if ( \is_null( $filedata ) AND !\is_null( $filepath ) )
|
||||
{
|
||||
$filedata = file_get_contents( $filepath );
|
||||
}
|
||||
@@ -648,6 +661,33 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_cover_photo'] = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $info['event_edit_time'] ) )
|
||||
{
|
||||
if ( $info['event_edit_time'] instanceof \IPS\DateTime )
|
||||
{
|
||||
$info['event_edit_time'] = $info['event_edit_time']->getTimestamp();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['event_edit_time'] = NULL;
|
||||
}
|
||||
|
||||
if ( !isset( $info['event_edit_member_name'] ) )
|
||||
{
|
||||
$info['event_edit_member_name'] = NULL;
|
||||
}
|
||||
|
||||
if ( !isset( $info['event_edit_reason'] ) )
|
||||
{
|
||||
$info['event_edit_reason'] = '';
|
||||
}
|
||||
|
||||
if ( !isset( $info['event_append_edit'] ) )
|
||||
{
|
||||
$info['event_append_edit'] = 0;
|
||||
}
|
||||
|
||||
$id = $info['event_id'];
|
||||
unset( $info['event_id'] );
|
||||
@@ -898,13 +938,13 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['review_votes_data'] ) )
|
||||
{
|
||||
if ( !is_array( $info['review_votes_data'] ) )
|
||||
if ( !\is_array( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes_data'] = json_decode( $info['review_votes_data'], TRUE );
|
||||
}
|
||||
|
||||
$newVoters = array();
|
||||
if ( !is_null( $info['review_votes_data'] ) AND count( $info['review_votes_data'] ) )
|
||||
if ( !\is_null( $info['review_votes_data'] ) AND \count( $info['review_votes_data'] ) )
|
||||
{
|
||||
foreach( $info['review_votes_data'] as $member => $vote )
|
||||
{
|
||||
@@ -921,7 +961,7 @@ class _Calendar extends Core
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $newVoters ) )
|
||||
if ( \count( $newVoters ) )
|
||||
{
|
||||
$info['review_votes_data'] = json_encode( $newVoters );
|
||||
}
|
||||
@@ -937,19 +977,19 @@ class _Calendar extends Core
|
||||
|
||||
if ( !isset( $info['review_votes'] ) )
|
||||
{
|
||||
if ( is_null( $info['review_votes_data'] ) )
|
||||
if ( \is_null( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['review_votes'] = count( json_decode( $info['review_votes_data'], TRUE ) );
|
||||
$info['review_votes'] = \count( json_decode( $info['review_votes_data'], TRUE ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset( $info['review_votes_helpful'] ) )
|
||||
{
|
||||
if ( is_null( $info['review_votes_data'] ) )
|
||||
if ( \is_null( $info['review_votes_data'] ) )
|
||||
{
|
||||
$info['review_votes_helpful'] = 0;
|
||||
}
|
||||
@@ -1044,7 +1084,7 @@ class _Calendar extends Core
|
||||
$info['rsvp_date'] = time();
|
||||
}
|
||||
|
||||
if ( !isset( $info['rsvp_response'] ) OR !in_array( $info['rsvp_response'], array( 0, 1, 2 ) ) )
|
||||
if ( !isset( $info['rsvp_response'] ) OR !\in_array( $info['rsvp_response'], array( 0, 1, 2 ) ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_rsvp_invalid_response', __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $info['rsvp_id'] : NULL );
|
||||
return FALSE;
|
||||
@@ -1205,7 +1245,7 @@ class _Calendar extends Core
|
||||
|
||||
if ( isset( $info['venue_address'] ) )
|
||||
{
|
||||
if ( is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
|
||||
if ( \is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
|
||||
{
|
||||
$info['venue_address'] = (string) \IPS\GeoLocation::getFromLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
|
||||
}
|
||||
@@ -1323,6 +1363,7 @@ class _Calendar extends Core
|
||||
* @param array $map Attachment Map Data
|
||||
* @param string|NULL $filepath Path to the file, or NULL.
|
||||
* @param string|NULL $filedata Binary data for the file, or NULL.
|
||||
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL.
|
||||
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
|
||||
*/
|
||||
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath=NULL )
|
||||
@@ -1338,7 +1379,7 @@ class _Calendar extends Core
|
||||
$map['id3'] = NULL;
|
||||
}
|
||||
|
||||
if ( is_null( $map['id3'] ) OR $map['id3'] != 'review' )
|
||||
if ( \is_null( $map['id3'] ) OR $map['id3'] != 'review' )
|
||||
{
|
||||
$map['id2_type'] = 'calendar_event_comments';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user