Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -37,16 +37,17 @@ class _Cms extends Core
|
||||
{
|
||||
return parent::getPostConversionInformation() . \IPS\Member::loggedIn()->language()->addToStack( 'convert_cms_info_message' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
|
||||
*
|
||||
* @param bool $rowCounts enable row counts
|
||||
* @return array
|
||||
*/
|
||||
public function menuRows()
|
||||
public function menuRows( $rowCounts=FALSE )
|
||||
{
|
||||
$return = array();
|
||||
$classname = get_class( $this->software );
|
||||
|
||||
foreach( $this->getConvertableItems() as $k => $v )
|
||||
{
|
||||
switch( $k )
|
||||
@@ -60,8 +61,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_blocks',
|
||||
'step_method' => 'convertCmsBlocks',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_blocks' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_blocks' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'cms_blocks',
|
||||
@@ -72,8 +73,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_containers',
|
||||
'step_method' => 'convertCmsContainers',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_containers' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_containers' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'cms_containers',
|
||||
@@ -89,8 +90,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_databases',
|
||||
'step_method' => 'convertCmsDatabases',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_databases' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_databases' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => $dependencies,
|
||||
'link_type' => 'cms_databases',
|
||||
@@ -101,8 +102,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_database_categories',
|
||||
'step_method' => 'convertCmsDatabaseCategories',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertCmsDatabases' ),
|
||||
'link_type' => 'cms_database_categories',
|
||||
@@ -114,7 +115,10 @@ class _Cms extends Core
|
||||
$links = array();
|
||||
foreach( \IPS\Db::i()->select( 'database_id', 'cms_databases' ) AS $database )
|
||||
{
|
||||
$count += \IPS\Db::i()->select( 'COUNT(*)', "cms_custom_database_{$database}" )->first();
|
||||
if( $rowCounts )
|
||||
{
|
||||
$count += \IPS\Db::i()->select( 'COUNT(*)', "cms_custom_database_{$database}" )->first();
|
||||
}
|
||||
$links[] = "cms_custom_database_{$database}";
|
||||
}
|
||||
|
||||
@@ -128,7 +132,7 @@ class _Cms extends Core
|
||||
'step_title' => 'convert_cms_database_records',
|
||||
'step_method' => 'convertCmsDatabaseRecords',
|
||||
'ips_rows' => $count,
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertCmsDatabases' ),
|
||||
'link_type' => $links,
|
||||
@@ -140,8 +144,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_database_comments',
|
||||
'step_method' => 'convertCmsDatabaseComments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_comments' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_comments' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'dependencies' => array( 'convertCmsDatabaseRecords' ),
|
||||
'link_type' => 'cms_database_comments',
|
||||
@@ -153,8 +157,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_database_reviews',
|
||||
'step_method' => 'convertCmsDatabaseReviews',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_reviews' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_reviews' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'dependencies' => array( 'convertCmsDatabaseRecords' ),
|
||||
'link_type' => 'cms_database_reviews',
|
||||
@@ -166,8 +170,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_folders',
|
||||
'step_method' => 'convertCmsFolders',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_folders' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_folders' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'cms_folders',
|
||||
@@ -184,8 +188,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_media',
|
||||
'step_method' => 'convertCmsMedia',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => $dependencies,
|
||||
'link_type' => 'cms_media',
|
||||
@@ -196,8 +200,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_media_folders',
|
||||
'step_method' => 'convertCmsMediaFolders',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media_folders' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media_folders' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'cms_media_folders',
|
||||
@@ -214,8 +218,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_pages',
|
||||
'step_method' => 'convertCmsPages',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_pages' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_pages' ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => $dependencies,
|
||||
'link_type' => 'cms_pages',
|
||||
@@ -232,8 +236,8 @@ class _Cms extends Core
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_attachments',
|
||||
'step_method' => 'convertAttachments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) ),
|
||||
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
#'dependencies' => array( 'convertCmsDatabaseRecords', 'convertCmsDatabaseComments', 'convertCmsDatabaseReviews' ),
|
||||
'dependencies' => array( 'convertCmsDatabaseRecords' ), //TODO dear code reviewer... please review this part.. i had to remove it for my further work
|
||||
@@ -245,6 +249,12 @@ class _Cms extends Core
|
||||
|
||||
$return = $this->software->extraMenuRows( $return );
|
||||
|
||||
/* Run the queries if we want row counts */
|
||||
if( $rowCounts )
|
||||
{
|
||||
$return = $this->getDatabaseRowCounts( $return );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -546,6 +556,8 @@ class _Cms extends Core
|
||||
$inserted_id = \IPS\Db::i()->insert( 'cms_pages', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'cms_pages' );
|
||||
\IPS\Lang::saveCustom( 'cms', "cms_page_{$inserted_id}", $info['page_name'] );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'pages', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
@@ -730,6 +742,8 @@ class _Cms extends Core
|
||||
|
||||
\IPS\Lang::saveCustom( 'cms', "content_block_name_{$inserted_id}", $name );
|
||||
\IPS\Lang::saveCustom( 'cms', "content_block_name_{$inserted_id}_desc", $desc );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'blocks', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
@@ -1060,6 +1074,8 @@ class _Cms extends Core
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'cms_databases', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'cms_databases' );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'databases', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
|
||||
/* And now fields */
|
||||
$validFields = array_merge( static::$fieldTypes, \IPS\cms\Fields::$additionalFieldTypes, array( 'Youtube', 'Spotify', 'Soundcloud' ) );
|
||||
@@ -1297,6 +1313,8 @@ class _Cms extends Core
|
||||
\IPS\Lang::saveCustom( 'cms', "content_field_{$fieldInsertedId}", $fieldName );
|
||||
\IPS\Lang::saveCustom( 'cms', "content_field_{$fieldInsertedId}_desc", $fieldDesc );
|
||||
$this->software->app->addLink( $fieldInsertedId, $fieldId, 'cms_database_fields' );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'fields', 'perm_type_id' => $fieldInsertedId, 'perm_view' => '' ) );
|
||||
|
||||
if ( $haveTitleField AND $titleField == 0 )
|
||||
{
|
||||
@@ -1777,6 +1795,7 @@ class _Cms extends Core
|
||||
$this->software->app->addLink( $inserted_id, $id, 'cms_database_categories' );
|
||||
|
||||
\IPS\Db::i()->update( 'cms_database_categories', array( "category_parent_id" => $inserted_id ), array( "category_conv_parent=? AND category_conv_parent<>?", $id, 0 ) );
|
||||
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'categories', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
|
||||
|
||||
\IPS\Lang::saveCustom( 'cms', "content_cat_name_{$inserted_id}", $info['category_name'] );
|
||||
\IPS\Lang::saveCustom( 'cms', "content_cat_name_{$inserted_id}_desc", $desc );
|
||||
|
||||
Reference in new issue
Block a user