Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -41,8 +41,8 @@ class _Upgrade
|
||||
'conf_default' => 'letters',
|
||||
'conf_value' => $_SESSION['upgrade_options']['core']['101100']['letter_photos'] ? 'letters' : 'default',
|
||||
'conf_app' => 'core'
|
||||
) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
), TRUE );
|
||||
\IPS\Settings::i()->clearCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -140,394 +140,13 @@ class _Upgrade
|
||||
{
|
||||
return "Removing orphaned data";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create/Convert Member History Table
|
||||
*
|
||||
* @return array 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 step3()
|
||||
{
|
||||
/* This step is different if Commerce is already installed */
|
||||
if( \IPS\Db::i()->checkForTable( 'nexus_customer_history' ) )
|
||||
{
|
||||
$_SESSION['convertedMemberHistory'] = TRUE;
|
||||
\IPS\Db::i()->renameTable( 'nexus_customer_history', 'core_member_history' );
|
||||
\IPS\Db::i()->addColumn( 'core_member_history',
|
||||
array(
|
||||
'name' => 'log_app',
|
||||
'type' => 'VARCHAR',
|
||||
'length' => 250,
|
||||
'allow_null' => FALSE,
|
||||
'default' => '',
|
||||
'comment' => 'Application'
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->createTable( array(
|
||||
'name' => 'core_member_history',
|
||||
'columns' =>
|
||||
array(
|
||||
'log_id' =>
|
||||
array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true,
|
||||
'binary' => false,
|
||||
'comment' => 'ID Number',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 20,
|
||||
'name' => 'log_id',
|
||||
'type' => 'BIGINT',
|
||||
'unsigned' => true,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_app' =>
|
||||
array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => 'Application',
|
||||
'decimals' => NULL,
|
||||
'default' => '',
|
||||
'length' => 250,
|
||||
'name' => 'log_app',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_member' =>
|
||||
array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => 'Member ID',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 20,
|
||||
'name' => 'log_member',
|
||||
'type' => 'BIGINT',
|
||||
'unsigned' => true,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_by' =>
|
||||
array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => 'Action performed by',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 20,
|
||||
'name' => 'log_by',
|
||||
'type' => 'BIGINT',
|
||||
'unsigned' => true,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_type' =>
|
||||
array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => 'Log Type',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 32,
|
||||
'name' => 'log_type',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_data' =>
|
||||
array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 0,
|
||||
'name' => 'log_data',
|
||||
'type' => 'TEXT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_date' =>
|
||||
array(
|
||||
'allow_null' => false,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => '0',
|
||||
'length' => 10,
|
||||
'name' => 'log_date',
|
||||
'type' => 'INT',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
),
|
||||
'log_ip_address' =>
|
||||
array(
|
||||
'allow_null' => true,
|
||||
'auto_increment' => false,
|
||||
'binary' => false,
|
||||
'comment' => '',
|
||||
'decimals' => NULL,
|
||||
'default' => NULL,
|
||||
'length' => 46,
|
||||
'name' => 'log_ip_address',
|
||||
'type' => 'VARCHAR',
|
||||
'unsigned' => false,
|
||||
'values' => array(),
|
||||
'zerofill' => false,
|
||||
)
|
||||
),
|
||||
'indexes' =>
|
||||
array(
|
||||
'PRIMARY' =>
|
||||
array(
|
||||
'type' => 'primary',
|
||||
'name' => 'PRIMARY',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_id',
|
||||
),
|
||||
),
|
||||
'application' =>
|
||||
array(
|
||||
'type' => 'key',
|
||||
'name' => 'application',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_app',
|
||||
),
|
||||
),
|
||||
'log_member' =>
|
||||
array(
|
||||
'type' => 'key',
|
||||
'name' => 'log_member',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_member',
|
||||
),
|
||||
),
|
||||
'log_ip_address' =>
|
||||
array(
|
||||
'type' => 'key',
|
||||
'name' => 'log_ip_address',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_ip_address',
|
||||
),
|
||||
),
|
||||
'log_date' =>
|
||||
array(
|
||||
'type' => 'key',
|
||||
'name' => 'log_date',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_date',
|
||||
),
|
||||
)
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Setting up Member History";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add index and set log_app
|
||||
*
|
||||
* @return array 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 step4()
|
||||
{
|
||||
/* Only perform this if converting from Nexus */
|
||||
if( isset( $_SESSION['convertedMemberHistory'] ) )
|
||||
{
|
||||
\IPS\Db::i()->returnQuery = TRUE;
|
||||
$queryApplication = \IPS\Db::i()->addIndex( 'core_member_history', array(
|
||||
'type' => 'key',
|
||||
'name' => 'application',
|
||||
'length' =>
|
||||
array(
|
||||
0 => NULL,
|
||||
),
|
||||
'columns' =>
|
||||
array(
|
||||
0 => 'log_app',
|
||||
)
|
||||
) );
|
||||
\IPS\Db::i()->returnQuery = FALSE;
|
||||
|
||||
\IPS\Db::i()->returnQuery = TRUE;
|
||||
$updateQuery = \IPS\Db::i()->update( 'core_member_history', array( 'log_app' => 'nexus' ) );
|
||||
\IPS\Db::i()->returnQuery = FALSE;
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( array(
|
||||
array(
|
||||
'table' => 'core_member_history',
|
||||
'query' => $queryApplication ),
|
||||
array(
|
||||
'table' => 'core_member_history',
|
||||
'query' => $updateQuery )
|
||||
) );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 5 ) ) );
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
return "Checking indexes";
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Nexus 'info' types
|
||||
*
|
||||
* @return array 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 step5()
|
||||
{
|
||||
/* Only perform this if converting from Nexus */
|
||||
if( isset( $_SESSION['convertedMemberHistory'] ) )
|
||||
{
|
||||
/* Some init */
|
||||
$did = 0;
|
||||
$limit = 0;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_member_history', array( 'log_type=?', 'info' ), 'log_id ASC', array( $limit, 500 ) ) as $log )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
$data = json_decode( $log['log_data'], TRUE );
|
||||
|
||||
if( isset( $data['email'] ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_member_history', array(
|
||||
'log_app' => 'core',
|
||||
'log_type' => 'email_change',
|
||||
'log_data' => json_encode( array( 'old' => $data['email'], 'new' => '' ) )
|
||||
),
|
||||
array( 'log_id=?', $log['log_id'] )
|
||||
);
|
||||
}
|
||||
elseif( isset( $data['password'] ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_member_history', array(
|
||||
'log_app' => 'core',
|
||||
'log_type' => 'password_change',
|
||||
'log_data' => json_encode( array( 'password' => '' ) )
|
||||
),
|
||||
array( 'log_id=?', $log['log_id'] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return $limit + $did;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step5Count'], $_SESSION['convertedMemberHistory'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step5CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step5Count'] ) )
|
||||
{
|
||||
$_SESSION['_step5Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( 'log_type=?', 'info' ) )->first();
|
||||
}
|
||||
|
||||
return "Converting customer history log types (Converted so far: " . ( ( $limit > $_SESSION['_step5Count'] ) ? $_SESSION['_step5Count'] : $limit ) . ' out of ' . $_SESSION['_step5Count'] . ')';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move Display Name history to the Member History Table
|
||||
*
|
||||
* @return array 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 step6()
|
||||
public function step3()
|
||||
{
|
||||
/* Some init */
|
||||
$did = 0;
|
||||
@@ -570,7 +189,7 @@ class _Upgrade
|
||||
/* Delete table */
|
||||
\IPS\Db::i()->dropTable( 'core_dnames_change' );
|
||||
|
||||
unset( $_SESSION['_step6Count'] );
|
||||
unset( $_SESSION['_step3Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -580,16 +199,16 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step6CustomTitle()
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step6Count'] ) )
|
||||
if( !isset( $_SESSION['_step3Count'] ) )
|
||||
{
|
||||
$_SESSION['_step6Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_dnames_change' )->first();
|
||||
$_SESSION['_step3Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_dnames_change' )->first();
|
||||
}
|
||||
|
||||
return "Moving Display Name history to the Member History system (Converted so far: " . ( ( $limit > $_SESSION['_step6Count'] ) ? $_SESSION['_step6Count'] : $limit ) . ' out of ' . $_SESSION['_step6Count'] . ')';
|
||||
return "Moving Display Name history to the Member History system (Converted so far: " . ( ( $limit > $_SESSION['_step3Count'] ) ? $_SESSION['_step3Count'] : $limit ) . ' out of ' . $_SESSION['_step3Count'] . ')';
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +217,7 @@ class _Upgrade
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function step7()
|
||||
public function step4()
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_moderators', array( 'type=? AND ' . \IPS\Db::i()->in( 'id', iterator_to_array( \IPS\Db::i()->select('g_id', 'core_groups' ) ), TRUE ), 'g' ) );
|
||||
unset ( \IPS\Data\Store::i()->moderators );
|
||||
@@ -611,7 +230,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step7CustomTitle()
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
return "Removing non-existent moderator groups";
|
||||
}
|
||||
@@ -622,7 +241,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step8()
|
||||
public function step5()
|
||||
{
|
||||
/* Populate the table */
|
||||
if ( ! \IPS\Db::i()->select( 'COUNT(*)', 'core_social_promote_sharers' )->first() )
|
||||
@@ -644,7 +263,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step8CustomTitle()
|
||||
public function step5CustomTitle()
|
||||
{
|
||||
return "Setting up defaults for promotion";
|
||||
}
|
||||
@@ -655,11 +274,19 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step9()
|
||||
public function step6()
|
||||
{
|
||||
$position = 0;
|
||||
|
||||
/* Path fallback if a custom AdminCP directory is used. */
|
||||
$path = \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY;
|
||||
if( \IPS\CP_DIRECTORY != 'admin' AND !file_exists( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction' ) )
|
||||
{
|
||||
$path = \IPS\ROOT_PATH . '/admin';
|
||||
}
|
||||
|
||||
/* Go ahead and insert the default "Like" - if we aren't use likes, leave it disabled. */
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_like.png', file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction/react_like.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_like.png', file_get_contents( $path . '/install/reaction/react_like.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$id = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => 1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -670,7 +297,7 @@ class _Upgrade
|
||||
|
||||
foreach( array( 'thanks', 'haha', 'confused', 'sad' ) AS $reaction )
|
||||
{
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', "react_{$reaction}.png", file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/install/reaction/react_{$reaction}.png" ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', "react_{$reaction}.png", file_get_contents( $path . "/install/reaction/react_{$reaction}.png" ), 'reactions', FALSE, NULL, FALSE );
|
||||
$id = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => ( in_array( $reaction, array( 'confused', 'sad' ) ) ) ? 0 : 1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -688,7 +315,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step9CustomTitle()
|
||||
public function step6CustomTitle()
|
||||
{
|
||||
return "Creating default reactions";
|
||||
}
|
||||
@@ -699,15 +326,22 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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()
|
||||
public function step7()
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'max(reaction_position)', 'core_reactions' )->first();
|
||||
|
||||
/* Path fallback if a custom AdminCP directory is used. */
|
||||
$path = \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY;
|
||||
if( \IPS\CP_DIRECTORY != 'admin' AND !file_exists( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction' ) )
|
||||
{
|
||||
$path = \IPS\ROOT_PATH . '/admin';
|
||||
}
|
||||
|
||||
/* Now insert a positive or negative row based on settings and then run queries to adjust current reputation */
|
||||
switch( \IPS\Settings::i()->reputation_point_types )
|
||||
{
|
||||
case 'positive':
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_up.png', file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction/react_up.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_up.png', file_get_contents( $path . '/install/reaction/react_up.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$id = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => 1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -718,7 +352,7 @@ class _Upgrade
|
||||
break;
|
||||
|
||||
case 'negative':
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_down.png', file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction/react_down.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_down.png', file_get_contents( $path . '/install/reaction/react_down.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$id = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => -1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -729,7 +363,7 @@ class _Upgrade
|
||||
break;
|
||||
|
||||
case 'both':
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_up.png', file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction/react_up.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_up.png', file_get_contents( $path . '/install/reaction/react_up.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$posId = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => 1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -738,7 +372,7 @@ class _Upgrade
|
||||
) );
|
||||
\IPS\Lang::saveCustom( 'core', 'reaction_title_' . $posId, 'Upvote' );
|
||||
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_down.png', file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/reaction/react_down.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$fileObj = \IPS\File::create( 'core_Reaction', 'react_down.png', file_get_contents( $path . '/install/reaction/react_down.png' ), 'reactions', FALSE, NULL, FALSE );
|
||||
$negId = \IPS\Db::i()->insert( 'core_reactions', array(
|
||||
'reaction_value' => -1,
|
||||
'reaction_icon' => (string) $fileObj,
|
||||
@@ -757,7 +391,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step10CustomTitle()
|
||||
public function step7CustomTitle()
|
||||
{
|
||||
return "Creating default reactions";
|
||||
}
|
||||
@@ -768,7 +402,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step11()
|
||||
public function step8()
|
||||
{
|
||||
/* Now insert a positive or negative row based on settings and then run queries to adjust current reputation */
|
||||
switch( \IPS\Settings::i()->reputation_point_types )
|
||||
@@ -811,7 +445,7 @@ class _Upgrade
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 12 ) ) );
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 9 ) ) );
|
||||
|
||||
/* 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 ) ) ) );
|
||||
@@ -825,7 +459,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step11CustomTitle()
|
||||
public function step8CustomTitle()
|
||||
{
|
||||
return "Mapping existing reactions";
|
||||
}
|
||||
@@ -836,7 +470,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step12()
|
||||
public function step9()
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_member_ranks', 'pips=100', array('pips>?', 100 ) );
|
||||
|
||||
@@ -848,7 +482,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step12CustomTitle()
|
||||
public function step9CustomTitle()
|
||||
{
|
||||
return 'Fixing ranks';
|
||||
}
|
||||
@@ -859,7 +493,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step13()
|
||||
public function step10()
|
||||
{
|
||||
$position = 1;
|
||||
|
||||
@@ -869,7 +503,7 @@ class _Upgrade
|
||||
{
|
||||
list( $gid, $gUnit ) = explode( '&', $group['g_promotion'] );
|
||||
|
||||
if ( $gid > 0 and $gUnit > 0)
|
||||
if ( $gid > 0 and $gUnit > 0 )
|
||||
{
|
||||
$filters = array();
|
||||
|
||||
@@ -881,12 +515,12 @@ class _Upgrade
|
||||
/* Reputation */
|
||||
elseif( $group['g_promotion_type'] == 2 )
|
||||
{
|
||||
$filters['core_Reputation'] = array( 'reputation_operator' => 'gt', 'reputation_score' => $gUnit );
|
||||
$filters['core_Reputation'] = array( 'reputation_operator' => ( $gUnit == 1 ) ? 'eq' : 'gt', 'reputation_score' => ( $gUnit == 1 ) ? $gUnit : ( $gUnit - 1 ) );
|
||||
}
|
||||
/* Post count */
|
||||
else
|
||||
{
|
||||
$filters['core_Content'] = array( 'content_count_operator' => 'gt', 'content_count_score' => $gUnit );
|
||||
$filters['core_Content'] = array( 'content_count_operator' => ( $gUnit == 1 ) ? 'eq' : 'gt', 'content_count_score' => ( $gUnit == 1 ) ? $gUnit : ( $gUnit - 1 ) );
|
||||
}
|
||||
|
||||
$filters['core_Group'] = array( 'groups' => $group['g_id'] );
|
||||
@@ -931,7 +565,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step13CustomTitle()
|
||||
public function step10CustomTitle()
|
||||
{
|
||||
return 'Converting group promotion rules';
|
||||
}
|
||||
@@ -942,7 +576,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step14()
|
||||
public function step11()
|
||||
{
|
||||
if ( \IPS\Settings::i()->use_coppa OR \IPS\Settings::i()->minimum_age )
|
||||
{
|
||||
@@ -963,12 +597,11 @@ class _Upgrade
|
||||
\IPS\Db::i()->insert( 'core_sys_conf_settings', $insert );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'quick_register' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
\IPS\Settings::i()->changeValues( array( 'quick_register' => 0 ) );
|
||||
}
|
||||
|
||||
$required = array();
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_pfields_data', array( "pf_not_null=?", 1 ) ) AS $row )
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_pfields_data', array( "pf_not_null=? AND pf_admin_only!=?", 1, 1 ) ) AS $row )
|
||||
{
|
||||
$required[] = "core_pfield_{$row['pf_id']}";
|
||||
}
|
||||
@@ -987,7 +620,7 @@ class _Upgrade
|
||||
}
|
||||
|
||||
$optional = array();
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_pfields_data', array( "pf_show_on_reg=? AND pf_not_null=?", 1, 0 ) ) AS $row )
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_pfields_data', array( "pf_show_on_reg=? AND pf_not_null=? AND pf_admin_only!=?", 1, 0, 1 ) ) AS $row )
|
||||
{
|
||||
$optional[] = "core_pfield_{$row['pf_id']}";
|
||||
}
|
||||
@@ -1013,7 +646,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step14CustomTitle()
|
||||
public function step11CustomTitle()
|
||||
{
|
||||
return 'Setting up Profile Completion';
|
||||
}
|
||||
@@ -1024,7 +657,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step15()
|
||||
public function step12()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( 'row_id', 'core_admin_permission_rows', array( 'row_id_type=?', 'group' ) ) as $admin )
|
||||
{
|
||||
@@ -1039,7 +672,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step15CustomTitle()
|
||||
public function step12CustomTitle()
|
||||
{
|
||||
return 'Enabling social promotion for administrators';
|
||||
}
|
||||
@@ -1050,7 +683,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step16()
|
||||
public function step13()
|
||||
{
|
||||
/* Remove the offending entries */
|
||||
\IPS\Db::i()->returnQuery = TRUE;
|
||||
@@ -1064,7 +697,7 @@ class _Upgrade
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 17 ) ) );
|
||||
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 14 ) ) );
|
||||
|
||||
/* 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 ) ) ) );
|
||||
@@ -1078,7 +711,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step16CustomTitle()
|
||||
public function step13CustomTitle()
|
||||
{
|
||||
return 'Removing orphaned moderator logs';
|
||||
}
|
||||
@@ -1089,7 +722,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step17()
|
||||
public function step14()
|
||||
{
|
||||
$max = \IPS\Db::i()->select( 'MAX(set_order)', 'core_themes' )->first();
|
||||
|
||||
@@ -1105,13 +738,25 @@ class _Upgrade
|
||||
$theme->order = $max + 1;
|
||||
$theme->is_default = FALSE;
|
||||
$theme->is_acp_default = TRUE;
|
||||
$theme->save();
|
||||
|
||||
$theme->installThemeSettings();
|
||||
$theme->copyResourcesFromSet();
|
||||
try
|
||||
{
|
||||
$theme->save();
|
||||
|
||||
/* Name */
|
||||
\IPS\Lang::saveCustom( 'core', "core_theme_set_title_{$theme->id}", "4.2" );
|
||||
$theme->installThemeSettings();
|
||||
$theme->copyResourcesFromSet();
|
||||
|
||||
/* Name */
|
||||
\IPS\Lang::saveCustom( 'core', "core_theme_set_title_{$theme->id}", "4.2" );
|
||||
}
|
||||
catch( \IPS\Db\Exception $e )
|
||||
{
|
||||
/* Column does not exist, set_customized was added in 4.3, so may not yet exist */
|
||||
if( $e->getCode() != 1054 )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1121,7 +766,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step17CustomTitle()
|
||||
public function step14CustomTitle()
|
||||
{
|
||||
return 'Creating 4.2 theme';
|
||||
}
|
||||
@@ -1132,7 +777,7 @@ class _Upgrade
|
||||
*
|
||||
* @return array 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 step18()
|
||||
public function step15()
|
||||
{
|
||||
\IPS\core\FrontNavigation::insertMenuItem( NULL, array( 'app' => 'core', 'key' => 'Clubs' ), \IPS\Db::i()->select( 'MAX(position)', 'core_menu' )->first() );
|
||||
|
||||
@@ -1144,7 +789,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step18CustomTitle()
|
||||
public function step15CustomTitle()
|
||||
{
|
||||
return 'Adding clubs menu item';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user