Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -48,131 +48,11 @@ class _Upgrade
|
||||
|
||||
/**
|
||||
* Step 2
|
||||
* Fix followers from a 3.x 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 step2()
|
||||
{
|
||||
$perCycle = 250;
|
||||
$did = 0;
|
||||
$limit = intval( \IPS\Request::i()->extra );
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_follow', null, 'follow_id ASC', array( $limit, $perCycle ) ) as $follow )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
/* We of course don't need to update current 4.0 data */
|
||||
if( !in_array( $follow['follow_area'], array( 'topics', 'forums', 'files', 'images', 'entries', 'calendars', 'categories', 'albums', 'events' ) ) AND mb_strpos( $follow['follow_area'], 'ccs_custom_database' ) !== 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Figure out what to update */
|
||||
$update = $follow;
|
||||
|
||||
switch( $follow['follow_area'] )
|
||||
{
|
||||
case 'topics':
|
||||
$update['follow_area'] = 'topic';
|
||||
$update['follow_id'] = md5( 'forums;topic;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'forums':
|
||||
$update['follow_area'] = 'forum';
|
||||
$update['follow_id'] = md5( 'forums;forum;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'files':
|
||||
$update['follow_area'] = 'file';
|
||||
$update['follow_id'] = md5( 'downloads;file;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'images':
|
||||
$update['follow_area'] = 'image';
|
||||
$update['follow_id'] = md5( 'gallery;image;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'entries':
|
||||
$update['follow_area'] = 'entry';
|
||||
$update['follow_id'] = md5( 'blog;entry;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'calendars':
|
||||
$update['follow_area'] = 'calendar';
|
||||
$update['follow_id'] = md5( 'calendar;calendar;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
$update['follow_area'] = 'category';
|
||||
$update['follow_id'] = md5( $follow['follow_app'] . ';category;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'albums':
|
||||
$update['follow_area'] = 'album';
|
||||
$update['follow_id'] = md5( 'gallery;album;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'events':
|
||||
$update['follow_area'] = 'event';
|
||||
$update['follow_id'] = md5( 'calendar;event;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
default:
|
||||
$data = explode( '_', str_replace( 'ccs_custom_database_', '', $follow['follow_area'] ) );
|
||||
$update['follow_app'] = 'cms';
|
||||
$update['follow_area'] = $data[1] . $data[0];
|
||||
$update['follow_id'] = md5( 'cms;' . $update['follow_area'] . ';' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'core_follow', array( 'follow_id=?', $follow['follow_id'] ) );
|
||||
\IPS\Db::i()->replace( 'core_follow', $update );
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step2Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step2Count'] ) )
|
||||
{
|
||||
$_SESSION['_step2Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_follow' )->first();
|
||||
}
|
||||
|
||||
return "Fixing existing follows (Fixed so far: " . ( ( $limit > $_SESSION['_step2Count'] ) ? $_SESSION['_step2Count'] : $limit ) . ' out of ' . $_SESSION['_step2Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3
|
||||
* Convert old friends to followers
|
||||
*
|
||||
* @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()
|
||||
public function step2()
|
||||
{
|
||||
/* If we aren't upgrading from 3.x the table won't be present */
|
||||
if( !\IPS\Db::i()->checkForTable('profile_friends') )
|
||||
@@ -239,7 +119,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
if ( $_SESSION['upgrade_options']['core']['100003']['follow_options'] == 'no_convert' )
|
||||
{
|
||||
@@ -264,12 +144,12 @@ class _Upgrade
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4
|
||||
* Step 3
|
||||
* Fix advertisements
|
||||
*
|
||||
* @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()
|
||||
public function step3()
|
||||
{
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_advertisements', 'ad_active=1' )->first() )
|
||||
{
|
||||
@@ -285,18 +165,18 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step4CustomTitle()
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Setting advertisement statuses";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 5
|
||||
* Step 4
|
||||
* Clean up some misc stuff
|
||||
*
|
||||
* @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()
|
||||
public function step4()
|
||||
{
|
||||
if( !\IPS\Db::i()->checkForColumn( 'core_member_ranks', 'icon' ) )
|
||||
{
|
||||
@@ -374,19 +254,19 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step5CustomTitle()
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
return "Cleaning up member and member rank tables";
|
||||
}
|
||||
|
||||
/* ! Conversation Participants */
|
||||
/**
|
||||
* Step 6
|
||||
* Step 5
|
||||
* Conversation Participants
|
||||
*
|
||||
* @return mixed 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 step5()
|
||||
{
|
||||
$perCycle = 1000;
|
||||
$did = 0;
|
||||
@@ -428,7 +308,7 @@ class _Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step6CustomTitle()
|
||||
public function step5CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
if( !isset( $_SESSION['_step6Count'] ) )
|
||||
|
||||
Reference in new issue
Block a user