Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,16 +12,27 @@
namespace IPS\convert\Software\Cms;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use IPS\convert\Software;
use IPS\convert\Software\Exception;
use IPS\DateTime;
use IPS\Member;
use IPS\Task;
use OutOfRangeException;
use UnderflowException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Wordpress Pages Converter
*/
class _Wordpress extends \IPS\convert\Software
class Wordpress extends Software
{
/**
* Software Name
@@ -154,8 +165,8 @@ class _Wordpress extends \IPS\convert\Software
'field_required' => TRUE,
'field_default' => NULL,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack( 'convert_wp_typical_path' ),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack( 'convert_wp_typical_path' ),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
);
break;
@@ -165,8 +176,8 @@ class _Wordpress extends \IPS\convert\Software
'field_required' => TRUE,
'field_default' => NULL,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack( 'convert_wp_typical_path' ),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack( 'convert_wp_typical_path' ),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
);
break;
}
@@ -184,16 +195,16 @@ class _Wordpress extends \IPS\convert\Software
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' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
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' ) );
Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_records', 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
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' ) );
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" );
}
catch( \OutOfRangeException $e )
catch( OutOfRangeException $e )
{
return array();
}
@@ -264,7 +275,7 @@ class _Wordpress extends \IPS\convert\Software
) );
/* Throw an exception here to tell the library that we're done with this step */
throw new \IPS\convert\Software\Exception;
throw new Exception;
}
/**
@@ -353,7 +364,7 @@ class _Wordpress extends \IPS\convert\Software
$imagePath = rtrim( $this->app->_session['more_info']['convertCmsDatabaseRecords']['file_location'], '/' ) . '/' . $location;
$filename = basename( $imagePath );
}
catch( \UnderflowException $e ) {}
catch( UnderflowException $e ) {}
}
$info = array(
@@ -363,13 +374,13 @@ class _Wordpress extends \IPS\convert\Software
'record_locked' => ( $row['comment_status'] == 'closed' ) ? 1 : 0,
'record_comments' => $row['comment_count'],
'record_allow_comments' => 1,
'record_saved' => new \IPS\DateTime( $row['post_date'] ),
'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
'record_saved' => new DateTime( $row['post_date'] ),
'record_updated' => $row['post_modified'] !== '0000-00-00 00:00:00' ? new 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_publish_date' => new DateTime( $row['post_date'] ),
'record_image' => $filename,
);
@@ -408,7 +419,7 @@ class _Wordpress extends \IPS\convert\Software
'tag_meta_id' => $row['ID'],
'tag_text' => $tag,
'tag_member_id' => $row['post_author'],
'tag_added' => new \IPS\DateTime( $row['post_date'] ),
'tag_added' => new DateTime( $row['post_date'] ),
'tag_prefix' => 0,
'tag_meta_link' => 'cms_custom_database_' . $database,
'tag_meta_parent_link' => 'cms_database_categories',
@@ -452,7 +463,7 @@ class _Wordpress extends \IPS\convert\Software
'comment_id' => $row['comment_ID'],
'comment_database_id' => 1,
'comment_record_id' => $row['comment_post_ID'],
'comment_date' => new \IPS\DateTime( $row['comment_date'] ),
'comment_date' => new DateTime( $row['comment_date'] ),
'comment_ip_address' => $row['comment_author_IP'],
'comment_user' => $row['user_id'],
'comment_author' => $row['comment_author'],
@@ -522,7 +533,7 @@ class _Wordpress extends \IPS\convert\Software
$info = array(
'attach_id' => $row['ID'],
'attach_file' => basename( $meta['_wp_attached_file'] ),
'attach_date' => new \IPS\DateTime( $row['post_date'] ),
'attach_date' => new DateTime( $row['post_date'] ),
'attach_member_id' => $row['post_author']
);