Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -30,12 +30,6 @@ class _Upgrade
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
/* CIC accounts can run these queries fast and it takes more resources to rebuild the index afterwards en-masse */
|
||||
if ( ! \IPS\CIC )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_search_index' );
|
||||
}
|
||||
|
||||
$json = <<<JSON
|
||||
[
|
||||
{
|
||||
@@ -52,7 +46,7 @@ class _Upgrade
|
||||
"index_is_last_comment"
|
||||
],
|
||||
"length": [
|
||||
250,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
@@ -147,6 +141,19 @@ JSON;
|
||||
*/
|
||||
public function step4()
|
||||
{
|
||||
/* It is likely this will be attempted before settings are created */
|
||||
$currentDefaults = iterator_to_array( \IPS\Db::i()->select( '*', 'core_sys_conf_settings' )->setKeyField('conf_key')->setValueField('conf_default') );
|
||||
|
||||
foreach ( array(
|
||||
array( 'key' => 'vapid_public_key', 'default' => '' ),
|
||||
array( 'key' => 'vapid_private_key', 'default' => '' ) ) as $setting )
|
||||
{
|
||||
if ( ! array_key_exists( $setting['key'], $currentDefaults ) )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_sys_conf_settings', array( 'conf_key' => $setting['key'], 'conf_value' => $setting['default'], 'conf_default' => $setting['default'], 'conf_app' => 'core' ), TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate VAPID keys for web push notifications */
|
||||
try
|
||||
{
|
||||
@@ -193,9 +200,9 @@ JSON;
|
||||
|
||||
if ( ! empty( $data['comment'] ) )
|
||||
{
|
||||
$commentClass = $class::$commentClass;
|
||||
try
|
||||
{
|
||||
$commentClass = $class::$commentClass;
|
||||
$comment = $commentClass::load( $data['comment'] );
|
||||
\IPS\Db::i()->update( 'core_content_meta', [
|
||||
'meta_item_author' => $comment->author()->member_id,
|
||||
@@ -205,7 +212,6 @@ JSON;
|
||||
}
|
||||
catch( \Exception $e ){ }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ( $did ) ? ( $limit + $did ) : TRUE;
|
||||
@@ -319,7 +325,6 @@ JSON;
|
||||
}
|
||||
else
|
||||
{
|
||||
//\IPS\Db::i()->update( 'core_member_ranks', [ 'points=posts'] );
|
||||
\IPS\Db::i()->insert( 'core_achievements_rules', [
|
||||
'action' => 'core_Comment',
|
||||
'filters' => NULL,
|
||||
@@ -341,6 +346,12 @@ JSON;
|
||||
'badge_other' => 0,
|
||||
'enabled' => 1
|
||||
]);
|
||||
|
||||
/* Reset the member's achievement points to the same number of posts to retain existing rank position */
|
||||
\IPS\Db::i()->update( 'core_members', "achievements_points=member_posts" );
|
||||
|
||||
/* Set the rebuild date so the badge times are not from 1970 */
|
||||
\IPS\Settings::i()->changeValues( array( 'achievements_last_rebuilt' => time() ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -357,7 +368,6 @@ JSON;
|
||||
return "Setting up ranks";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set up background tasks for adding extra data to featured columns
|
||||
*
|
||||
@@ -390,9 +400,7 @@ JSON;
|
||||
$memberTitleField->save();
|
||||
\IPS\Lang::saveCustom( 'core', 'core_pfield_' . $memberTitleField->id, "Member Title" );
|
||||
\IPS\Lang::saveCustom( 'core', 'core_pfield_' . $memberTitleField->id . '_desc', "" );
|
||||
|
||||
$prefix = \IPS\Db::i()->prefix;
|
||||
\IPS\Db::i()->query( "UPDATE {$prefix}core_pfields_content c INNER JOIN {$prefix}core_members m ON m.member_id=c.member_id SET c.field_" . $memberTitleField->id . "=m.member_title WHERE LENGTH(m.member_title) > 0");
|
||||
$_SESSION['106100-TITLE-FIELD'] = $memberTitleField->id;
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
@@ -412,6 +420,34 @@ JSON;
|
||||
return "Preserving member titles";
|
||||
}
|
||||
|
||||
/**
|
||||
* Move member titles
|
||||
*
|
||||
* @return boolean If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
|
||||
*/
|
||||
public function step10()
|
||||
{
|
||||
if( empty( $_SESSION['106100-TITLE-FIELD'] ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( array( array(
|
||||
'table' => 'core_members',
|
||||
'query' => "UPDATE " . \IPS\Db::i()->prefix . "core_pfields_content c INNER JOIN " . \IPS\Db::i()->prefix . "core_members m ON m.member_id=c.member_id SET c.field_" . $_SESSION['106100-TITLE-FIELD'] . "=m.member_title WHERE LENGTH(m.member_title) > 0"
|
||||
) ) );
|
||||
|
||||
if ( \count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 11 ) ) );
|
||||
|
||||
/* Queries to run manually */
|
||||
return array( 'html' => \IPS\Theme::i()->getTemplate( 'forms' )->queries( $toRun, \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => \IPS\Request::i()->mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish step
|
||||
*
|
||||
@@ -419,18 +455,11 @@ JSON;
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
if( ! \IPS\CIC AND isset( \IPS\Settings::i()->search_method ) AND \IPS\Settings::i()->search_method == 'mysql' )
|
||||
if( isset( \IPS\Settings::i()->search_method ) AND \IPS\Settings::i()->search_method == 'mysql' )
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
}
|
||||
|
||||
/* Enable the onboarding system for those that still have the admincp notification active. */
|
||||
if( \IPS\core\AdminNotification::find('core', 'ConfigurationError', 'marketplaceSetup') )
|
||||
{
|
||||
/* Set onboard complete flag */
|
||||
\IPS\Settings::i()->changeValues( array( 'mp_onboard_complete' => 0 ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user