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'] ) )
|
||||
|
||||
@@ -92,11 +92,6 @@ class _Upgrade
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
if( !\IPS\Settings::i()->search_engine )
|
||||
{
|
||||
\IPS\Settings::i()->search_engine = 'mysql';
|
||||
}
|
||||
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,6 @@ class _Upgrade
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
if( !\IPS\Settings::i()->search_engine )
|
||||
{
|
||||
\IPS\Settings::i()->search_engine = 'mysql';
|
||||
}
|
||||
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,11 +55,6 @@ class _Upgrade
|
||||
*/
|
||||
public function step2()
|
||||
{
|
||||
if( !\IPS\Settings::i()->search_engine )
|
||||
{
|
||||
\IPS\Settings::i()->search_engine = 'mysql';
|
||||
}
|
||||
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
|
||||
return TRUE;
|
||||
@@ -106,7 +101,7 @@ class _Upgrade
|
||||
*/
|
||||
public function step4()
|
||||
{
|
||||
if( \IPS\Db::i()->select( 'count(*)', 'core_attachments_map', "location_key=1" ) )
|
||||
if( \IPS\Db::i()->select( 'count(*)', 'core_attachments_map', "location_key=1" )->first() )
|
||||
{
|
||||
foreach ( \IPS\Content::routedClasses( FALSE, TRUE ) as $class )
|
||||
{
|
||||
|
||||
@@ -38,23 +38,26 @@ class _Upgrade
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_notifications', array( 'notification_key = ?', 'new_private_message' ), 'id ASC', array( $limit, $perCycle ) ) as $row )
|
||||
if( \IPS\Db::i()->select( 'COUNT(*)', 'core_notifications' )->first() )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
try
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_notifications', array( 'notification_key = ?', 'new_private_message' ), 'id ASC', array( $limit, $perCycle ) ) as $row )
|
||||
{
|
||||
$message = \IPS\core\Messenger\Message::load( $row['item_sub_id'] );
|
||||
$conversation = $message->item();
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_notifications', array( 'item_class' => 'IPS\core\Messenger\Conversation', 'item_id' => $conversation->id ), array( 'id=?', $row['id'] ) );
|
||||
$did++;
|
||||
|
||||
try
|
||||
{
|
||||
$message = \IPS\core\Messenger\Message::load( $row['item_sub_id'] );
|
||||
$conversation = $message->item();
|
||||
|
||||
\IPS\Db::i()->update( 'core_notifications', array( 'item_class' => 'IPS\core\Messenger\Conversation', 'item_id' => $conversation->id ), array( 'id=?', $row['id'] ) );
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
}
|
||||
|
||||
if( $did )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Upgrade
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_emoticons' ) as $emoticon )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_emoticons', array( 'typed' => html_entity_decode( $emoticon['typed'], ENT_QUOTES, 'UTF-8' ) ), array( 'id=?', $emoticon['id'] ) );
|
||||
\IPS\Db::i()->update( 'core_emoticons', array( 'typed' => \IPS\Text\Parser::utf8mb4SafeDecode( $emoticon['typed'] ) ), array( 'id=?', $emoticon['id'] ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -35,6 +35,20 @@ class _Upgrade
|
||||
$limit = intval( \IPS\Request::i()->extra );
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
/* If this is the first cycle, make sure votes column can hold all the votes:
|
||||
@link https://community.invisionpower.com/4bugtrack/active-reports/348-to-40121-upgrade-error-out-of-range-value-for-column-votes-r7649/ */
|
||||
if( $limit === 0 )
|
||||
{
|
||||
\IPS\Db::i()->changeColumn( 'core_polls', 'votes', array(
|
||||
'name' => 'votes',
|
||||
'type' => 'mediumint',
|
||||
'length' => null,
|
||||
'unsigned' => false,
|
||||
'allow_null' => false,
|
||||
'default' => "0"
|
||||
) );
|
||||
}
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_polls', NULL, 'pid ASC', array( $limit, $perCycle ) ) as $poll )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
|
||||
@@ -30,10 +30,13 @@ class _Upgrade
|
||||
*/
|
||||
public function step1()
|
||||
{
|
||||
$prefix = \IPS\Db::i()->prefix;
|
||||
$query = "DELETE {$prefix}core_notifications.* FROM {$prefix}core_notifications LEFT JOIN {$prefix}core_member_status_replies ON({$prefix}core_member_status_replies.reply_id={$prefix}core_notifications.item_id AND {$prefix}core_notifications.item_class='IPS\\core\\Statuses\\Reply') WHERE {$prefix}core_notifications.notification_key='profile_reply' and {$prefix}core_member_status_replies.reply_id IS NULL";
|
||||
if( \IPS\Db::i()->select( 'COUNT(*)', 'core_notifications' )->first() )
|
||||
{
|
||||
$prefix = \IPS\Db::i()->prefix;
|
||||
$query = "DELETE {$prefix}core_notifications.* FROM {$prefix}core_notifications LEFT JOIN {$prefix}core_member_status_replies ON({$prefix}core_member_status_replies.reply_id={$prefix}core_notifications.item_id AND {$prefix}core_notifications.item_class='IPS\\core\\Statuses\\Reply') WHERE {$prefix}core_notifications.notification_key='profile_reply' and {$prefix}core_member_status_replies.reply_id IS NULL";
|
||||
|
||||
\IPS\Db::i()->query( $query );
|
||||
\IPS\Db::i()->query( $query );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -58,25 +58,28 @@ class _Upgrade
|
||||
*/
|
||||
public function step2()
|
||||
{
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_notifications',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_notifications WHERE item_class='IPS\\core\\Statuses\\Status' AND item_id NOT IN (SELECT status_id FROM " . \IPS\Db::i()->prefix . "core_member_status_updates)",
|
||||
),
|
||||
array(
|
||||
'table' => 'core_notifications',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_notifications WHERE item_class='IPS\\core\\Statuses\\Reply' AND item_id NOT IN (SELECT reply_id FROM " . \IPS\Db::i()->prefix . "core_member_status_replies)",
|
||||
)
|
||||
);
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
if( \IPS\Db::i()->select( 'COUNT(*)', 'core_notifications' )->first() )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 3 ) ) );
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_notifications',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_notifications WHERE item_class='IPS\\core\\Statuses\\Status' AND item_id NOT IN (SELECT status_id FROM " . \IPS\Db::i()->prefix . "core_member_status_updates)",
|
||||
),
|
||||
array(
|
||||
'table' => 'core_notifications',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_notifications WHERE item_class='IPS\\core\\Statuses\\Reply' AND item_id NOT IN (SELECT reply_id FROM " . \IPS\Db::i()->prefix . "core_member_status_replies)",
|
||||
)
|
||||
);
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 3 ) ) );
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Upgrader: Custom Upgrade Options
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 26 Oct 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
$options = array();
|
||||
|
||||
/* Check utilitiesMenu */
|
||||
try
|
||||
{
|
||||
$affectedThemes = array();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_theme_templates', array( array( 'template_set_id > 0 and template_name=? and template_group=? and template_app=? and template_location=?', 'globalTemplate', 'global', 'core', 'front' ) ) ) as $template )
|
||||
{
|
||||
if ( mb_stristr( $template['template_content'], '{template="utilitiesMenu"' ) )
|
||||
{
|
||||
$affectedThemes[] = $template['template_set_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $affectedThemes ) )
|
||||
{
|
||||
$options[] = new \IPS\Helpers\Form\Radio( '101000_globalTemplate_revert', 'no', TRUE, array( 'options' => array( 'yes' => '101000_yes', 'no' => '101000_no' ) ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,712 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "createTable",
|
||||
"params": [
|
||||
{
|
||||
"name": "core_menu",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "BIGINT",
|
||||
"length": "20",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"binary": false,
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"auto_increment": true,
|
||||
"comment": "ID Number"
|
||||
},
|
||||
"app": {
|
||||
"name": "app",
|
||||
"type": "VARCHAR",
|
||||
"length": 250,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"comment": "The application key for the item",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"extension": {
|
||||
"name": "extension",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The FrontNavigation extension key",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"config": {
|
||||
"name": "config",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Any additional configuration",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"position": {
|
||||
"name": "position",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "1",
|
||||
"comment": "This item's position within the bar",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"parent": {
|
||||
"name": "parent",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The ID of the parent item if this is on the second bar, or NULL if the first bar",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"permissions": {
|
||||
"name": "permissions",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"comment": "Comma-delimited list of group IDs, or * for all",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"PRIMARY": {
|
||||
"type": "primary",
|
||||
"name": "PRIMARY",
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "createTable",
|
||||
"params": [
|
||||
{
|
||||
"name": "core_streams",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "BIGINT",
|
||||
"length": "20",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"binary": false,
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"auto_increment": true,
|
||||
"comment": "ID Number"
|
||||
},
|
||||
"classes": {
|
||||
"name": "classes",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The classes this stream will pull from or null for all",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"containers": {
|
||||
"name": "containers",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "A JSON-encoded array of classes to allowed containers or NULL for all",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"read": {
|
||||
"name": "read",
|
||||
"type": "ENUM",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"all",
|
||||
"unread"
|
||||
],
|
||||
"allow_null": false,
|
||||
"default": "all",
|
||||
"comment": "If the stream only includes unread items",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"follow": {
|
||||
"name": "follow",
|
||||
"type": "ENUM",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"all",
|
||||
"followed"
|
||||
],
|
||||
"allow_null": false,
|
||||
"default": "all",
|
||||
"comment": "If the stream only shows followed content",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"date_start": {
|
||||
"name": "date_start",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If using a custom date, the start date",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"position": {
|
||||
"name": "position",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": null,
|
||||
"comment": "The position in the list",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"member": {
|
||||
"name": "member",
|
||||
"type": "MEDIUMINT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The member who created the stream or null for a global stream",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"sort": {
|
||||
"name": "sort",
|
||||
"type": "ENUM",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"newest",
|
||||
"oldest"
|
||||
],
|
||||
"allow_null": false,
|
||||
"default": "newest",
|
||||
"comment": "Whether the stream sorts newest first or oldest first by default",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"date_type": {
|
||||
"name": "date_type",
|
||||
"type": "ENUM",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"all",
|
||||
"last_visit",
|
||||
"custom",
|
||||
"relative"
|
||||
],
|
||||
"allow_null": false,
|
||||
"default": "all",
|
||||
"comment": "The date range for the stream",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"date_end": {
|
||||
"name": "date_end",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If using a custom date, the end date",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"date_relative_days": {
|
||||
"name": "date_relative_days",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If using a relative date period, the number of days",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"custom_members": {
|
||||
"name": "custom_members",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If using custom ownership, the member IDs",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"tags": {
|
||||
"name": "tags",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "Tags to match",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"followed_types": {
|
||||
"name": "followed_types",
|
||||
"type": "SET",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"containers",
|
||||
"items",
|
||||
"members"
|
||||
],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If filtering by followed content, what kind of follows to include",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"ownership": {
|
||||
"name": "ownership",
|
||||
"type": "ENUM",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [
|
||||
"all",
|
||||
"started",
|
||||
"postedin",
|
||||
"custom"
|
||||
],
|
||||
"allow_null": false,
|
||||
"default": "all",
|
||||
"comment": "Stream pulls all content or only content the viewer has started or posted in",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"include_comments": {
|
||||
"name": "include_comments",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "1",
|
||||
"comment": "Should comments and reviews be included?",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"title": {
|
||||
"name": "title",
|
||||
"type": "VARCHAR",
|
||||
"length": 255,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "If this is a member-created stream, the title (admin created streams use language strings)",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
},
|
||||
"default": {
|
||||
"name": "default",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "Default item shows to the right of the top breadcrumb navigation",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"PRIMARY": {
|
||||
"type": "primary",
|
||||
"name": "PRIMARY",
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_follow",
|
||||
{
|
||||
"name": "follow_index_id",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The ID from core_search_index",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "delete",
|
||||
"params": [
|
||||
"core_search_index"
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"name": "index_item_index_id",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The index ID of the item",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"name": "index_item_author",
|
||||
"type": "MEDIUMINT",
|
||||
"length": 8,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "The author of the item",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_members",
|
||||
{
|
||||
"name": "member_streams",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_members",
|
||||
{
|
||||
"name": "photo_last_update",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"9": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"core_members",
|
||||
"vnc_preferences"
|
||||
]
|
||||
},
|
||||
"10": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "index_date_created",
|
||||
"columns": [
|
||||
"index_date_created"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"11": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_emoticons",
|
||||
{
|
||||
"name": "image_2x",
|
||||
"type": "TEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"12": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_emoticons",
|
||||
{
|
||||
"name": "width",
|
||||
"type": "SMALLINT",
|
||||
"length": 3,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"13": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_emoticons",
|
||||
{
|
||||
"name": "height",
|
||||
"type": "SMALLINT",
|
||||
"length": 3,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"14": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"type": "fulltext",
|
||||
"name": "index_tags",
|
||||
"columns": [
|
||||
"index_tags"
|
||||
],
|
||||
"length": [
|
||||
250
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"15": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"core_polls",
|
||||
"votes",
|
||||
{
|
||||
"name": "votes",
|
||||
"type": "MEDIUMINT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"16": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"name": "index_is_last_comment",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "Is this the last comment\/review on an item?",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"17": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"core_soft_delete_log",
|
||||
"sdl_obj_key",
|
||||
{
|
||||
"name": "sdl_obj_key",
|
||||
"type": "VARCHAR",
|
||||
"length": 128,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"18": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"core_search_index",
|
||||
{
|
||||
"type": "fulltext",
|
||||
"name": "index_title",
|
||||
"columns": [
|
||||
"index_title"
|
||||
],
|
||||
"length": [
|
||||
250
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,702 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.1.0 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 29 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\setup\upg_101000;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1: Sort out the global template
|
||||
*
|
||||
* @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 step1()
|
||||
{
|
||||
/* Drop globalTemplates */
|
||||
if ( isset( $_SESSION['upgrade_options']['core']['101000']['globalTemplate_revert'] ) and $_SESSION['upgrade_options']['core']['101000']['globalTemplate_revert'] == 'yes' )
|
||||
{
|
||||
$templateIds = array();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_theme_templates', array( array( 'template_set_id > 0 and template_name=? and template_group=? and template_app=? and template_location=?', 'globalTemplate', 'global', 'core', 'front' ) ) ) as $template )
|
||||
{
|
||||
if ( mb_stristr( $template['template_content'], '{template="utilitiesMenu"' ) )
|
||||
{
|
||||
$templateIds[] = $template['template_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $templateIds ) )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_theme_templates', array( \IPS\Db::i()->in( 'template_id', $templateIds ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Upgrading menu";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2: Add email to upgrade notification emails
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => \IPS\Settings::i()->email_in ), "conf_key = 'upgrade_email'" );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Setting upgrade notifications email address";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3: Rebuild search index
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Initiating search index rebuild";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4: Upgrade emoticons
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$json = json_decode( file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY ."/install/emoticons/data.json" ), TRUE );
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_emoticons', \IPS\Db::i()->in( 'typed', array_keys( $json ) ) ) as $emoticon )
|
||||
{
|
||||
if( !isset( $json[ $emoticon['typed'] ]['image_2x'] ) or !file_exists(\IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/install/emoticons/" . $json[ $emoticon['typed'] ]['image_2x'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$imageDimensions = \IPS\File::get( 'core_Emoticons', $emoticon['image'] )->getImageDimensions();
|
||||
$fileObj2x = \IPS\File::create( 'core_Emoticons', $json[ $emoticon['typed'] ]['image_2x'], NULL, 'emoticons', TRUE, \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/install/emoticons/" . $json[ $emoticon['typed'] ]['image_2x'], FALSE );
|
||||
|
||||
$update = array(
|
||||
'image_2x' => (string) $fileObj2x,
|
||||
'width' => $imageDimensions[0] ,
|
||||
'height' => $imageDimensions[1]
|
||||
);
|
||||
\IPS\Db::i()->update( 'core_emoticons', $update, array( 'typed=?', $emoticon['typed'] ) );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
return "Upgrading emoticons";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 5: Populate default streams
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
/* Grab the inserts from the schematic as they will always be the most up to date */
|
||||
$json = json_decode( file_get_contents( \IPS\ROOT_PATH . '/applications/core/data/schema.json' ), TRUE );
|
||||
|
||||
foreach( $json['core_streams']['inserts'] as $data )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_streams', $data );
|
||||
}
|
||||
catch( \IPS\Db\Exception $ex ) { }
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step5CustomTitle()
|
||||
{
|
||||
return "Populating default streams";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 6
|
||||
* Fix followers from a 3.x upgrade - We have to do this here because the original code was wrong, and we need to fix people affected between then and now
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
/* Init */
|
||||
$perCycle = 250;
|
||||
$did = 0;
|
||||
$limit = intval( \IPS\Request::i()->extra );
|
||||
|
||||
/* Because follow_id gets changed in the process, we have to copy data to a temporary table first */
|
||||
if ( !$limit )
|
||||
{
|
||||
$tableDefinition = \IPS\Db::i()->getTableDefinition( 'core_follow' );
|
||||
\IPS\Db::i()->renameTable( 'core_follow', 'core_follow_backup' );
|
||||
\IPS\Db::i()->createTable( $tableDefinition );
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
/* Now do it - sort by follow_added ASC so that we do them in reverse order so if a new record was added which is now correct, that is what gets maintained */
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_follow_backup', NULL, 'follow_added ASC', array( $limit, $perCycle ) ) as $follow )
|
||||
{
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
/* Increase the counter */
|
||||
$did++;
|
||||
|
||||
/* Figure out what to update */
|
||||
$insert = $follow;
|
||||
switch( $follow['follow_area'] )
|
||||
{
|
||||
case 'topics':
|
||||
$insert['follow_area'] = 'topic';
|
||||
$insert['follow_id'] = md5( 'forums;topic;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'forums':
|
||||
$insert['follow_area'] = 'forum';
|
||||
$insert['follow_id'] = md5( 'forums;forum;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'files':
|
||||
$insert['follow_area'] = 'file';
|
||||
$insert['follow_id'] = md5( 'downloads;file;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'images':
|
||||
$insert['follow_area'] = 'image';
|
||||
$insert['follow_id'] = md5( 'gallery;image;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'entries':
|
||||
$insert['follow_area'] = 'entry';
|
||||
$insert['follow_id'] = md5( 'blog;entry;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'calendars':
|
||||
$insert['follow_area'] = 'calendar';
|
||||
$insert['follow_id'] = md5( 'calendar;calendar;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
$insert['follow_area'] = 'category';
|
||||
$insert['follow_id'] = md5( $follow['follow_app'] . ';category;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'albums':
|
||||
$insert['follow_area'] = 'album';
|
||||
$insert['follow_id'] = md5( 'gallery;album;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
case 'events':
|
||||
$insert['follow_area'] = 'event';
|
||||
$insert['follow_id'] = md5( 'calendar;event;' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( mb_strpos( $follow['follow_area'], 'ccs_custom_database' ) === 0 )
|
||||
{
|
||||
$data = explode( '_', str_replace( 'ccs_custom_database_', '', $follow['follow_area'] ) );
|
||||
$insert['follow_app'] = 'cms';
|
||||
$insert['follow_area'] = $data[1] . $data[0];
|
||||
$insert['follow_id'] = md5( 'cms;' . $insert['follow_area'] . ';' . $follow['follow_rel_id'] . ';' . $follow['follow_member_id'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* And insert */
|
||||
\IPS\Db::i()->replace( 'core_follow', $insert );
|
||||
}
|
||||
|
||||
/* More to do? */
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
/* Nope - carry on */
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->dropTable( 'core_follow_backup' );
|
||||
unset( $_SESSION['_step2Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step6CustomTitle()
|
||||
{
|
||||
$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 7: Adjust email SMTP host/protocol
|
||||
*
|
||||
* @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 step7()
|
||||
{
|
||||
/* We only need to do this if there is an SMTP host and it is something like tls://domain */
|
||||
if( \IPS\Settings::i()->smtp_host AND mb_strpos( \IPS\Settings::i()->smtp_host, '://' ) !== FALSE )
|
||||
{
|
||||
/* First we need to insert the setting since it won't be present just yet */
|
||||
\IPS\Db::i()->replace( 'core_sys_conf_settings', array( 'conf_key' => 'smtp_protocol', 'conf_default' => 'plain', 'conf_app' => 'core' ) );
|
||||
|
||||
/* Now figure out what we need to set it to */
|
||||
$protocol = mb_substr( \IPS\Settings::i()->smtp_host, 0, mb_strpos( \IPS\Settings::i()->smtp_host, '://' ) );
|
||||
$host = mb_substr( \IPS\Settings::i()->smtp_host, mb_strpos( \IPS\Settings::i()->smtp_host, '://' ) + 3 );
|
||||
|
||||
/* And update */
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $host ), "conf_key = 'smtp_host'" );
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $protocol ), "conf_key = 'smtp_protocol'" );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step7CustomTitle()
|
||||
{
|
||||
return "Adjusting email configuration";
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Remove some legacy columns if they still exist
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
if ( \IPS\Db::i()->checkForColumn( 'core_bulk_mail', 'mail_pergo' ) )
|
||||
{
|
||||
$columns[] = 'mail_pergo';
|
||||
}
|
||||
|
||||
if ( \IPS\Db::i()->checkForColumn( 'core_bulk_mail', 'mail_groups' ) )
|
||||
{
|
||||
$columns[] = 'mail_groups';
|
||||
}
|
||||
|
||||
if( count( $columns ) )
|
||||
{
|
||||
\IPS\Db::i()->dropColumn( 'core_bulk_mail', $columns );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step8CustomTitle()
|
||||
{
|
||||
return "Cleaning up bulk mail database table";
|
||||
}
|
||||
|
||||
/**
|
||||
* Update widgets and menu
|
||||
*
|
||||
* @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 finish()
|
||||
{
|
||||
/* Create the new default configuration */
|
||||
\IPS\core\FrontNavigation::buildDefaultFrontNavigation();
|
||||
$maxPosition = \IPS\Db::i()->select( 'MAX(position)', 'core_menu', 'parent IS NULL' )->first();
|
||||
|
||||
/* Add the home link if necessary */
|
||||
if ( \IPS\Settings::i()->show_home_link )
|
||||
{
|
||||
$id = \IPS\Db::i()->insert( 'core_menu', array(
|
||||
'app' => 'core',
|
||||
'extension' => 'CustomItem',
|
||||
'config' => json_encode( array( 'menu_custom_item_url' => \IPS\Settings::i()->home_url ) ),
|
||||
'position' => ++$maxPosition,
|
||||
'parent' => NULL,
|
||||
'permissions' => '*',
|
||||
) );
|
||||
\IPS\Lang::copyCustom( 'core', 'home_name_value', "menu_item_{$id}" );
|
||||
\IPS\Lang::deleteCustom( 'core', 'home_name_value' );
|
||||
}
|
||||
|
||||
/* And pages? */
|
||||
if ( \IPS\Application::appIsEnabled('cms') )
|
||||
{
|
||||
$rootId = \IPS\Db::i()->insert( 'core_menu', array(
|
||||
'app' => 'core',
|
||||
'extension' => 'CustomItem',
|
||||
'config' => json_encode( array( 'menu_custom_item_url' => 'app=cms&module=pages&controller=page', 'internal' => 'content' ) ),
|
||||
'position' => ++$maxPosition,
|
||||
'parent' => NULL,
|
||||
'permissions' => '*',
|
||||
) );
|
||||
|
||||
/* 3.x to 4.x won't have language strings installed at this point */
|
||||
try
|
||||
{
|
||||
$pagesLang = \IPS\Lang::load( \IPS\Lang::defaultLanguage() )->get("__app_cms");
|
||||
}
|
||||
catch( \UnderflowException $ex )
|
||||
{
|
||||
$pagesLang = "Pages";
|
||||
}
|
||||
|
||||
\IPS\Lang::saveCustom( 'core', "menu_item_{$rootId}", $pagesLang );
|
||||
|
||||
$position = 1;
|
||||
foreach ( \IPS\Db::i()->select( '*', 'cms_page_menu' ) as $menuItem )
|
||||
{
|
||||
if ( $menuItem['menu_type'] == 'page' )
|
||||
{
|
||||
$app = 'cms';
|
||||
$extension = 'Pages';
|
||||
$config = array( 'menu_content_page' => $menuItem['menu_content'], 'menu_title_page_type' => ( $menuItem['menu_title'] ? 1 : 0 ) );
|
||||
}
|
||||
elseif ( $menuItem['menu_type'] == 'folder' )
|
||||
{
|
||||
$app = 'core';
|
||||
$extension = 'Menu';
|
||||
$config = array();
|
||||
}
|
||||
elseif ( $menuItem['menu_type'] == 'url' )
|
||||
{
|
||||
$app = 'core';
|
||||
$extension = 'CustomItem';
|
||||
$config = array( 'menu_custom_item_url' => $menuItem['menu_content'] );
|
||||
}
|
||||
|
||||
$_id = \IPS\Db::i()->insert( 'core_menu', array(
|
||||
'id' => $menuItem['menu_id'] + $rootId,
|
||||
'app' => $app,
|
||||
'extension' => $extension,
|
||||
'config' => json_encode( $config ),
|
||||
'position' => $position++,
|
||||
'parent' => $menuItem['menu_parent_id'] ? ( $menuItem['menu_parent_id'] + $rootId ) : $rootId,
|
||||
'permissions' => $menuItem['menu_permission'] == 'page' ? '*' : $menuItem['menu_permission'],
|
||||
) );
|
||||
|
||||
if ( $menuItem['menu_type'] == 'folder' or $menuItem['menu_type'] == 'url' )
|
||||
{
|
||||
\IPS\Lang::copyCustom( 'cms', "cms_menu_title_{$menuItem['menu_id']}", "menu_item_{$_id}", 'core' );
|
||||
\IPS\Lang::deleteCustom( 'cms', "cms_menu_title_{$menuItem['menu_id']}" );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Lang::copyCustom( 'cms', "cms_menu_title_{$menuItem['menu_id']}", "cms_menu_title_{$_id}" );
|
||||
\IPS\Lang::deleteCustom( 'cms', "cms_menu_title_{$menuItem['menu_id']}" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
\IPS\Db::i()->dropTable('cms_page_menu');
|
||||
}
|
||||
|
||||
$areas = array( 'core_widget_areas' );
|
||||
if ( \IPS\Application::appIsEnabled('cms') )
|
||||
{
|
||||
$areas[] = 'cms_page_widget_areas';
|
||||
}
|
||||
|
||||
foreach ( $areas as $table )
|
||||
{
|
||||
foreach ( \IPS\Db::i()->select( '*', $table ) as $area )
|
||||
{
|
||||
$widgetsColumn = $table == 'core_widget_areas' ? 'widgets' : 'area_widgets';
|
||||
$whereClause = $table == 'core_widget_areas' ? array( 'id=? AND area=?', $area['id'], $area['area'] ) : array( 'area_page_id=? AND area_area=?', $area['area_page_id'], $area['area_area'] );
|
||||
|
||||
$widgets = json_decode( $area[ $widgetsColumn ], TRUE );
|
||||
$update = FALSE;
|
||||
|
||||
foreach ( $widgets as $k => $widget )
|
||||
{
|
||||
if ( $widget['key'] == 'topicFeed' )
|
||||
{
|
||||
if ( isset( $widgets[ $k ]['configuration'] ) )
|
||||
{
|
||||
$update = TRUE;
|
||||
$config = array();
|
||||
foreach ( $widgets[ $k ]['configuration'] as $_k => $_v )
|
||||
{
|
||||
if ( $_k === 'widget_feed_status' )
|
||||
{
|
||||
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'open', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'pinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'featured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'featured';
|
||||
}
|
||||
else if ( in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'notfeatured';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgets[ $k ]['configuration'][ $_k ] = $_v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $widget['key'] == 'postFeed' )
|
||||
{
|
||||
if ( isset( $widgets[ $k ]['configuration'] ) )
|
||||
{
|
||||
$update = TRUE;
|
||||
$config = array();
|
||||
foreach ( $widgets[ $k ]['configuration'] as $_k => $_v )
|
||||
{
|
||||
if ( in_array( $_k, array( 'tfb_show', 'tfb_sort_dir', 'tfb_use_perms', 'tfb_topic_status' ) ) )
|
||||
{
|
||||
$_k = str_replace( 'tfb_', 'widget_feed', $_k );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_k = str_replace( 'tfb_', 'widget_feed_item', $_k );
|
||||
}
|
||||
|
||||
if ( $_k == 'widget_feed_topic_status' )
|
||||
{
|
||||
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_locked'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'open', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_locked'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_locked'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'pinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'featured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'featured';
|
||||
}
|
||||
else if ( in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_item_status_pinned'] = 'notfeatured';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgets[ $k ]['configuration'][ $_k ] = $_v;
|
||||
}
|
||||
|
||||
$widgets[ $k ]['configuration'][ $_k ] = $_v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $widget['key'] == 'RecordFeed' )
|
||||
{
|
||||
if ( isset( $widgets[ $k ]['configuration'] ) )
|
||||
{
|
||||
$config = array();
|
||||
foreach ( $widgets[ $k ]['configuration'] as $_k => $_v )
|
||||
{
|
||||
$_k = str_replace( 'cms_rf', 'widget_feed', $_k );
|
||||
if ( $_k == 'widget_feed_record_status' )
|
||||
{
|
||||
$_k = 'widget_feed_status';
|
||||
}
|
||||
|
||||
if ( $_k === 'widget_feed_status' )
|
||||
{
|
||||
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'open', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'closed', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_locked'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'pinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'open';
|
||||
}
|
||||
else if ( in_array( 'notpinned', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'closed';
|
||||
}
|
||||
|
||||
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'any';
|
||||
}
|
||||
else if ( in_array( 'featured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'featured';
|
||||
}
|
||||
else if ( in_array( 'notfeatured', $_v ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_status_pinned'] = 'notfeatured';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgets[ $k ]['configuration'][ $_k ] = $_v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $update )
|
||||
{
|
||||
\IPS\Db::i()->update( $table, array( $widgetsColumn => json_encode( $widgets ) ), $whereClause );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"core_follow",
|
||||
{
|
||||
"follow_notify_freq": "immediate"
|
||||
},
|
||||
"follow_notify_freq NOT IN('immediate','daily','weekly','none')"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"core_acronyms",
|
||||
"a_short",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "a_short",
|
||||
"columns": [
|
||||
"a_short"
|
||||
],
|
||||
"length": [
|
||||
250
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"core_acronyms",
|
||||
"a_short",
|
||||
{
|
||||
"name": "a_short",
|
||||
"type": "TEXT",
|
||||
"length": "",
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"core_acronyms",
|
||||
"a_long",
|
||||
{
|
||||
"name": "a_long",
|
||||
"type": "TEXT",
|
||||
"length": "",
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.1.0 Beta 2 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 06 Oct 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\setup\upg_101001;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Beta 2 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Some file storage extensions (i.e. CMS) may never have been saved in the upload_settings setting, which resulted in the RepairFileUrls not being run against them,
|
||||
* which then results in the files being deleted by the orphaned files tool because the full URL is still stored
|
||||
*
|
||||
* @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 step1()
|
||||
{
|
||||
/* Anything that is not set, we'll assume the same setting as core_Attachment */
|
||||
$settings = json_decode( \IPS\Settings::i()->upload_settings, TRUE );
|
||||
$defaultSetting = $settings['filestorage__core_Attachment'];
|
||||
|
||||
/* Set some variables to help us determine if we need to do anything else after */
|
||||
$hasChanges = FALSE;
|
||||
$applications = array();
|
||||
|
||||
/* Loop over all file storage extensions */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'FileStorage', FALSE, NULL, NULL, TRUE ) as $name => $obj )
|
||||
{
|
||||
if( !isset( $settings[ "filestorage__{$name}" ] ) )
|
||||
{
|
||||
$settings[ "filestorage__{$name}" ] = $defaultSetting;
|
||||
$hasChanges = TRUE;
|
||||
|
||||
$_extension = explode( '_', $name );
|
||||
$applications[ $_extension[0] ] = $_extension[0];
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, if we have changes, update the setting and reinitiate the RepairFileUrls background queue task for the affected application(s) */
|
||||
if( $hasChanges )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => json_encode( $settings ) ), array( 'conf_key=?', 'upload_settings' ) );
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
foreach( $applications as $app )
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::repairFileUrls( $app );
|
||||
}
|
||||
}
|
||||
|
||||
/* That's all ... easy peasy */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Fixing missing upload storage configurations";
|
||||
}
|
||||
|
||||
/**
|
||||
* Orphaned private message maps from older versions can cause errors for specific users
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_message_topic_user_map',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_message_topic_user_map WHERE map_topic_id NOT IN(SELECT mt_id FROM " . \IPS\Db::i()->prefix . "core_message_topics)",
|
||||
)
|
||||
);
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 3 ) ) );
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Removing orphaned personal message maps";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.1.0 Beta 5 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 15 Oct 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\setup\upg_101004;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Beta 5 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* If there are follows for member records that no longer exists, this causes an error when trying to send the non-existent user a notification later
|
||||
*
|
||||
* @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 step1()
|
||||
{
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_follow',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_follow WHERE follow_member_id NOT IN(SELECT member_id FROM " . \IPS\Db::i()->prefix . "core_members)",
|
||||
)
|
||||
);
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 2 ) ) );
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Removing orphaned follows";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"core_members_warn_reasons",
|
||||
{
|
||||
"wr_remove": "-1"
|
||||
},
|
||||
[
|
||||
"wr_remove=?",
|
||||
0
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.1.0 Beta 7 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 16 Oct 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\setup\upg_101006;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.1.0 Beta 7 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Clean up orphaned status updates
|
||||
*
|
||||
* @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 step1()
|
||||
{
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_member_status_updates',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_member_status_updates WHERE status_member_id NOT IN(SELECT member_id FROM " . \IPS\Db::i()->prefix . "core_members)",
|
||||
),
|
||||
array(
|
||||
'table' => 'core_member_status_updates',
|
||||
'query' => "DELETE FROM " . \IPS\Db::i()->prefix . "core_member_status_updates WHERE status_author_id NOT IN(SELECT member_id FROM " . \IPS\Db::i()->prefix . "core_members)",
|
||||
)
|
||||
);
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 2 ) ) );
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Removing orphaned status updates";
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to clean up template editing logs
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_admin_logs', array( 'do=? OR do=?', 'deleteTemplate', 'saveTemplate' ) ) as $template )
|
||||
{
|
||||
$update = array();
|
||||
$data = json_decode( $template['note'], TRUE );
|
||||
|
||||
/* deleteTemplate previously just stored "name => FALSE", so we need to populate the rest of the data which we don't have -
|
||||
as this is legacy though and won't be an issue moving forward, it isn't too big a deal */
|
||||
if( $template['do'] == 'deleteTemplate' )
|
||||
{
|
||||
$keys = array_keys( $data );
|
||||
|
||||
$update['note'] = json_encode( array( '(unknown)' => FALSE, '(unknown)' => FALSE, '(unknown)' => FALSE, $keys[0] => FALSE ) );
|
||||
}
|
||||
/* saveTemplate stored all the data but in a way that won't be retrievable, so we need to convert it */
|
||||
else
|
||||
{
|
||||
$update['note'] = json_encode( array( $data['app'] => FALSE, $data['location'] => FALSE, $data['group'] => FALSE, $data['name'] => FALSE ) );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_admin_logs', $update, array( 'id=?', $template['id'] ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Adjusting administrator logs";
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim leading path slash if present
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$toRunQueries = array(
|
||||
array(
|
||||
'table' => 'core_attachments',
|
||||
'query' => "UPDATE " . \IPS\Db::i()->prefix . "core_attachments SET attach_location=SUBSTR( attach_location, 2 ) WHERE attach_location LIKE '/%'",
|
||||
),
|
||||
array(
|
||||
'table' => 'core_attachments',
|
||||
'query' => "UPDATE " . \IPS\Db::i()->prefix . "core_attachments SET attach_thumb_location=SUBSTR( attach_thumb_location, 2 ) WHERE attach_thumb_location LIKE '/%'",
|
||||
)
|
||||
);
|
||||
|
||||
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $toRunQueries );
|
||||
|
||||
if ( count( $toRun ) )
|
||||
{
|
||||
$mr = \IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 'extra' => array( '_upgradeStep' => 3 ) ) );
|
||||
|
||||
/* 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' => $mr ) ) ) );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
return "Fixing broken attachment paths";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix moderator permissions - containers need to be -1 instead of 0 to represent "all containers"
|
||||
* This has to be run last so that the other app tables have been renamed
|
||||
*
|
||||
* @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 finish()
|
||||
{
|
||||
/* We have to figure out which fields are 'node' fields */
|
||||
$nodeFields = array();
|
||||
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'ModeratorPermissions', FALSE, 'core' ) as $k => $ext )
|
||||
{
|
||||
foreach( $ext->getPermissions( array() ) as $name => $data )
|
||||
{
|
||||
$type = is_array( $data ) ? $data[0] : $data;
|
||||
|
||||
if( $type == 'Node' )
|
||||
{
|
||||
$nodeFields[ $name ] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now loop over moderators and fix them */
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_moderators' ) as $moderator )
|
||||
{
|
||||
/* We only need to fix them if the perms aren't * */
|
||||
if( $moderator['perms'] !== '*' )
|
||||
{
|
||||
$perms = json_decode( $moderator['perms'], TRUE );
|
||||
$hasChange = FALSE;
|
||||
|
||||
foreach( $perms as $k => $v )
|
||||
{
|
||||
if( in_array( $k, $nodeFields ) AND $v == 0 )
|
||||
{
|
||||
$perms[ $k ] = -1;
|
||||
$hasChange = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Only bother updating if we need to */
|
||||
if( $hasChange )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_moderators', array( 'perms' => json_encode( $perms ) ), array( 'type=? AND id=?', $moderator['type'], $moderator['id'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"core_members",
|
||||
{
|
||||
"pp_photo_type": null
|
||||
},
|
||||
[
|
||||
"pp_photo_type=? and ( pp_main_photo=? or pp_main_photo IS NULL )",
|
||||
"custom",
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ while ( $table = $tables->fetch_assoc() )
|
||||
|
||||
$definition = \IPS\Db::i()->getTableDefinition( preg_replace( '/^' . $prefix . '/', '', $tableName ), FALSE, TRUE );
|
||||
|
||||
if( isset( $definition['collation'] ) AND mb_strtolower( mb_substr( $definition['collation'], 0, 4 ) !== 'utf8' ) )
|
||||
if( isset( $definition['collation'] ) AND !in_array( $definition['collation'], array( 'utf8_unicode_ci', 'utf8mb4_unicode_ci' ) ) )
|
||||
{
|
||||
$convert = TRUE;
|
||||
break;
|
||||
@@ -55,7 +55,7 @@ while ( $table = $tables->fetch_assoc() )
|
||||
|
||||
while ( $column = $columns->fetch_assoc() )
|
||||
{
|
||||
if ( $column['Collation'] and mb_strtolower( mb_substr( $column['Collation'], 0, 4 ) !== 'utf8' ) )
|
||||
if ( $column['Collation'] and !in_array( $column['Collation'], array( 'utf8_unicode_ci', 'utf8mb4_unicode_ci' ) ) )
|
||||
{
|
||||
$convert = TRUE;
|
||||
break 2;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -178,6 +178,12 @@ class _Upgrade
|
||||
$guestGroup = $INFO['guest_group'];
|
||||
$validatingGroup = $INFO['auth_group'];
|
||||
$memberGroup = $INFO['member_group'];
|
||||
|
||||
/* If the admin for some reason set member_group and auth_group to the same value in conf_global, that's no good */
|
||||
if( $validatingGroup == $memberGroup )
|
||||
{
|
||||
$validatingGroup = NULL;
|
||||
}
|
||||
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
@@ -462,7 +468,7 @@ class _Upgrade
|
||||
$newSecondaryGroups = array();
|
||||
foreach( explode( ',', $row['mgroup_others'] ) AS $secondaryGroup )
|
||||
{
|
||||
if ( ! in_array( $secondaryGroup, array( $bannedGroup, $validatingGroup, $guestGroup ) ) )
|
||||
if ( $secondaryGroup AND ! in_array( $secondaryGroup, array( $bannedGroup, $validatingGroup, $guestGroup ) ) )
|
||||
{
|
||||
$newSecondaryGroups[] = $secondaryGroup;
|
||||
}
|
||||
@@ -561,7 +567,7 @@ class _Upgrade
|
||||
}
|
||||
|
||||
/* Decode names */
|
||||
$row['name'] = html_entity_decode( $row['name'], ENT_QUOTES, 'UTF-8' );
|
||||
$row['name'] = \IPS\Text\Parser::utf8mb4SafeDecode( $row['name'] );
|
||||
|
||||
/* Remap some columns */
|
||||
$row['member_posts'] = (int) $row['posts'];
|
||||
@@ -675,9 +681,14 @@ class _Upgrade
|
||||
\IPS\Db::i()->dropTable( 'profile_portal' );
|
||||
\IPS\Db::i()->renameTable( 'core_members_temp', 'core_members' );
|
||||
|
||||
if ( $bannedGroup and $validatingGroup )
|
||||
if ( $bannedGroup )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_groups', 'g_id IN(' . $bannedGroup . ',' . $validatingGroup . ')' );
|
||||
\IPS\Db::i()->delete( 'core_groups', 'g_id=' . $bannedGroup );
|
||||
}
|
||||
|
||||
if ( $validatingGroup )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_groups', 'g_id=' . $validatingGroup );
|
||||
}
|
||||
|
||||
if( isset( $_SESSION['idm_block_submissions'] ) )
|
||||
@@ -782,7 +793,7 @@ class _Upgrade
|
||||
/* Retain log in method (username, email or both) */
|
||||
if( $login['login_user_id'] )
|
||||
{
|
||||
$data = ( $data === NULL ) ? array() : $data;
|
||||
$data = ( is_array( $data ) ) ? $data : array();
|
||||
|
||||
switch( $login['login_user_id'] )
|
||||
{
|
||||
@@ -1804,42 +1815,44 @@ DROP INDEX like_lookup_area"
|
||||
catch( \UnderflowException $e ){}
|
||||
|
||||
$className = $insert['class'];
|
||||
|
||||
try
|
||||
if( class_exists( $className ) )
|
||||
{
|
||||
/* Some tables haven't been renamed yet so build the data manually */
|
||||
if( $table )
|
||||
try
|
||||
{
|
||||
$row = \IPS\DB::i()->select( "*", $table, array( "{$className::$databaseColumnId} = ?", $report['exdat3'] ? $report['exdat2'] : $report['exdat1'] ) )->first();
|
||||
$content = $className::constructFromData( $row );
|
||||
|
||||
if( $itemTable )
|
||||
/* Some tables haven't been renamed yet so build the data manually */
|
||||
if( $table )
|
||||
{
|
||||
$itemClass = $className::$itemClass;
|
||||
$itemRow = \IPS\DB::i()->select("*", $itemTable, array("{$itemClass::$databaseColumnId} = ?", $content->mapped('item')))->first();
|
||||
$item = $itemClass::constructFromData($itemRow);
|
||||
$row = \IPS\DB::i()->select( "*", $table, array( "{$className::$databaseColumnId} = ?", $report['exdat3'] ? $report['exdat2'] : $report['exdat1'] ) )->first();
|
||||
$content = $className::constructFromData( $row );
|
||||
|
||||
$containerClass = $itemClass::$containerNodeClass;
|
||||
$containerRow = \IPS\DB::i()->select("*", $containerTable, array("{$containerClass::$databaseColumnId} = ?", $item->mapped('container')))->first();
|
||||
$container = $containerClass::constructFromData($containerRow);
|
||||
if( $itemTable )
|
||||
{
|
||||
$itemClass = $className::$itemClass;
|
||||
$itemRow = \IPS\DB::i()->select("*", $itemTable, array("{$itemClass::$databaseColumnId} = ?", $content->mapped('item')))->first();
|
||||
$item = $itemClass::constructFromData($itemRow);
|
||||
|
||||
$permissions = $container->permissions();
|
||||
$insert['perm_id'] = $permissions['perm_id'];
|
||||
$containerClass = $itemClass::$containerNodeClass;
|
||||
$containerRow = \IPS\DB::i()->select("*", $containerTable, array("{$containerClass::$databaseColumnId} = ?", $item->mapped('container')))->first();
|
||||
$container = $containerClass::constructFromData($containerRow);
|
||||
|
||||
$permissions = $container->permissions();
|
||||
$insert['perm_id'] = $permissions['perm_id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = $className::load( $report['exdat3'] ? $report['exdat2'] : $report['exdat1'] );
|
||||
$insert['perm_id'] = $content->permId();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = $className::load( $report['exdat3'] ? $report['exdat2'] : $report['exdat1'] );
|
||||
$insert['perm_id'] = $content->permId();
|
||||
}
|
||||
|
||||
$insert['author'] = $content->mapped('author');
|
||||
$insert['author'] = $content->mapped('author');
|
||||
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
|
||||
/* Insert new report */
|
||||
\IPS\Db::i()->insert( 'core_rc_index', $insert );
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
|
||||
/* Insert new report */
|
||||
\IPS\Db::i()->insert( 'core_rc_index', $insert );
|
||||
}
|
||||
|
||||
if( $did )
|
||||
@@ -2617,7 +2630,7 @@ DROP INDEX like_lookup_area"
|
||||
$table = 'core_attachments';
|
||||
|
||||
$url = \IPS\Request::i()->url();
|
||||
$settings = array( 'upload_dir' => \IPS\ROOT_PATH . '/uploads' , 'upload_url' => str_replace( 'http://', '//', preg_replace( '#/admin/.*$#', '/uploads', $url ) ) );
|
||||
$settings = array( 'upload_dir' => '', 'upload_url' => '' );
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_sys_conf_settings', array( "conf_key IN('upload_dir', 'upload_url', 'gallery_images_url', 'gallery_images_path', 'idm_screenshot_url',
|
||||
'idm_filestorage', 'idm_localfilepath', 'idm_localsspath', 'idm_remoteport', 'idm_remotessurl', 'idm_remotefileurl', 'idm_filestorage', 'idm_remoteurl', 'idm_remoteuser',
|
||||
@@ -2632,7 +2645,7 @@ DROP INDEX like_lookup_area"
|
||||
|
||||
$settings[ $row['conf_key'] ] = $row['conf_value'];
|
||||
}
|
||||
else
|
||||
else if( $row['conf_default'] )
|
||||
{
|
||||
$settings[ $row['conf_key'] ] = $row['conf_default'];
|
||||
}
|
||||
@@ -2647,6 +2660,12 @@ DROP INDEX like_lookup_area"
|
||||
/* if the old dir doesn't exist, set this now so at least themes work */
|
||||
if( ! is_dir( $settings['upload_dir'] ) )
|
||||
{
|
||||
/* Protocol relative URLs in 3.x confuse this upgrade step */
|
||||
if ( mb_substr( \IPS\Settings::i()->base_url, 0, 2 ) === '//' )
|
||||
{
|
||||
\IPS\Settings::i()->base_url = 'http:' . \IPS\Settings::i()->base_url;
|
||||
}
|
||||
|
||||
$settings['upload_dir'] = \IPS\ROOT_PATH . '/uploads';
|
||||
$settings['upload_url'] = \IPS\Settings::i()->base_url . 'uploads';
|
||||
}
|
||||
@@ -2693,7 +2712,7 @@ DROP INDEX like_lookup_area"
|
||||
}
|
||||
|
||||
/* Gallery */
|
||||
if( isset( $settings['gallery_images_path'] ) AND $settings['gallery_images_path'] != $settings['upload_dir'] )
|
||||
if( isset( $settings['gallery_images_path'] ) AND $settings['gallery_images_path'] AND $settings['gallery_images_path'] != $settings['upload_dir'] )
|
||||
{
|
||||
$url = $settings['gallery_images_url'] ?: rtrim( \IPS\Settings::i()->base_url, '/' ) . '/applications/gallery/interface/legacy/image.php?path=';
|
||||
$gallery = \IPS\Db::i()->insert( 'core_file_storage', array( 'method' => 'FileSystem', 'configuration' => json_encode( array( 'dir' => str_replace( \IPS\ROOT_PATH, '{root}', $settings['gallery_images_path'] ), 'url' => str_replace( $strReplace, '', $url ) ) ) ) );
|
||||
@@ -2704,7 +2723,7 @@ DROP INDEX like_lookup_area"
|
||||
}
|
||||
|
||||
/* Blog */
|
||||
if( isset( $settings['blog_upload_dir'] ) AND $settings['blog_upload_dir'] != $settings['upload_dir'] )
|
||||
if( isset( $settings['blog_upload_dir'] ) AND $settings['blog_upload_dir'] AND $settings['blog_upload_dir'] != $settings['upload_dir'] )
|
||||
{
|
||||
$blog = \IPS\Db::i()->insert( 'core_file_storage', array( 'method' => 'FileSystem', 'configuration' => json_encode( array( 'dir' => str_replace( \IPS\ROOT_PATH, '{root}', $settings['blog_upload_dir'] ), 'url' => str_replace( $strReplace, '', $settings['blog_upload_url'] ) ) ) ) );
|
||||
}
|
||||
@@ -2752,15 +2771,15 @@ DROP INDEX like_lookup_area"
|
||||
if( \IPS\Db::i()->checkForTable( 'downloads_files_records' ) )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_files',
|
||||
\IPS\Db::i()->select( "NULL, " . \IPS\Db::i()->prefix . "downloads_files_records.record_realname, MD5( RAND() ), " . \IPS\Db::i()->prefix . "downloads_filestorage.storage_file, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', \IPS\Db::i()->prefix . "downloads_filestorage.storage_id=" . \IPS\Db::i()->prefix . "downloads_files_records.record_id" )
|
||||
\IPS\Db::i()->select( "NULL, downloads_files_records.record_realname, MD5( RAND() ), downloads_filestorage.storage_file, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', "downloads_filestorage.storage_id=downloads_files_records.record_id" )
|
||||
);
|
||||
|
||||
\IPS\Db::i()->insert( 'core_files',
|
||||
\IPS\Db::i()->select( "NULL, " . \IPS\Db::i()->prefix . "downloads_files_records.record_realname, MD5( RAND() ), " . \IPS\Db::i()->prefix . "downloads_filestorage.storage_ss, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', \IPS\Db::i()->prefix . "downloads_filestorage.storage_id=" . \IPS\Db::i()->prefix . "downloads_files_records.record_id" )
|
||||
\IPS\Db::i()->select( "NULL, downloads_files_records.record_realname, MD5( RAND() ), downloads_filestorage.storage_ss, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', "downloads_filestorage.storage_id=downloads_files_records.record_id" )
|
||||
);
|
||||
|
||||
\IPS\Db::i()->insert( 'core_files',
|
||||
\IPS\Db::i()->select( "NULL, " . \IPS\Db::i()->prefix . "downloads_files_records.record_realname, MD5( RAND() ), " . \IPS\Db::i()->prefix . "downloads_filestorage.storage_thumb, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', \IPS\Db::i()->prefix . "downloads_filestorage.storage_id=" . \IPS\Db::i()->prefix . "downloads_files_records.record_id" )
|
||||
\IPS\Db::i()->select( "NULL, downloads_files_records.record_realname, MD5( RAND() ), downloads_filestorage.storage_thumb, NULL", 'downloads_filestorage' )->join( 'downloads_files_records', "downloads_filestorage.storage_id=downloads_files_records.record_id" )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2867,7 +2886,7 @@ DROP INDEX like_lookup_area"
|
||||
{
|
||||
$pathDetails = explode( '/', $row[ $column ] );
|
||||
$fileName = array_pop( $pathDetails );
|
||||
$newPathname = implode( '/', $pathDetails ) . '/' . $row['attach_file'] . '.' . md5( uniqid( microtime() ) );
|
||||
$newPathname = ltrim( implode( '/', $pathDetails ) . '/' . $row['attach_file'] . '.' . md5( uniqid( microtime() ) ), '/' );
|
||||
|
||||
if( @rename( $settings['upload_dir'] . '/' . $row[ $column ], $settings['upload_dir'] . '/' . $newPathname ) )
|
||||
{
|
||||
@@ -2878,40 +2897,47 @@ DROP INDEX like_lookup_area"
|
||||
|
||||
if ( $table === 'core_member_ranks' )
|
||||
{
|
||||
if ( !is_numeric( $row[ $column ] ) )
|
||||
/* The "pips" column is not required to be filled in */
|
||||
if ( $row[ $column ] AND !is_numeric( $row[ $column ] ) )
|
||||
{
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/' . $publicPath . '/style_extra/team_icons/' . $row[ $column ] ) )
|
||||
{
|
||||
@copy( \IPS\ROOT_PATH . '/' . $publicPath . '/style_extra/team_icons/' . $row[ $column ], $settings['upload_dir'] . '/pip_' . $row[ $column ] );
|
||||
|
||||
$update[ $column ] = 'pip_' . $row[ $column ];
|
||||
}
|
||||
|
||||
$update[ $column ] = 'pip_' . $row[ $column ];
|
||||
}
|
||||
}
|
||||
else if ( $table === 'core_groups' )
|
||||
{
|
||||
if ( mb_strpos( $row[ $column ], 'team_icons' ) AND file_exists( \IPS\ROOT_PATH . '/' . $row[ $column ] ) )
|
||||
/* Do we have an image? */
|
||||
if( $row[ $column ] )
|
||||
{
|
||||
$path = explode( '/', $row[ $column ] );
|
||||
$file = array_pop( $path );
|
||||
$_test = parse_url( $row[ $column ] );
|
||||
$path = explode( '/', $row[ $column ] );
|
||||
$file = array_pop( $path );
|
||||
|
||||
@copy( \IPS\ROOT_PATH . '/' . $row[ $column ], $settings['upload_dir'] . '/team_' . $file );
|
||||
|
||||
$update[ $column ] = 'team_' . $file;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $row[ $column ] )
|
||||
/* If this is a relative path, we should copy the image and use that path */
|
||||
if( ( !isset( $_test['host'] ) OR !$_test['host'] ) AND file_exists( \IPS\ROOT_PATH . '/' . $row[ $column ] ) )
|
||||
{
|
||||
$_test = parse_url( $row[ $column ] );
|
||||
@copy( \IPS\ROOT_PATH . '/' . $row[ $column ], $settings['upload_dir'] . '/team_' . $file );
|
||||
|
||||
if( !isset( $_test['host'] ) OR !$_test['host'] )
|
||||
$update[ $column ] = 'team_' . $file;
|
||||
}
|
||||
/* Otherwise if this is a URL, we should copy the file locally */
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$update[ $column ] = rtrim( \IPS\Settings::i()->base_url, '/' ) . '/' . $row[ $column ];
|
||||
$contents = \IPS\Http\Url::external( $row[ $column ] )->request()->get();
|
||||
|
||||
@file_put_contents( $settings['upload_dir'] . '/team_' . $file, $contents );
|
||||
|
||||
$update[ $column ] = 'team_' . $file;
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if ( $table === 'core_emoticons' )
|
||||
{
|
||||
@@ -2932,9 +2958,23 @@ DROP INDEX like_lookup_area"
|
||||
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/' . $publicPath . '/style_emoticons/' . $row['emo_set'] . '/' . $row['image'] ) )
|
||||
{
|
||||
@copy( \IPS\ROOT_PATH . '/' . $publicPath . '/style_emoticons/' . $row['emo_set'] . '/' . $row['image'], $path . '/' . $row['emo_set'] . '_' . $row['image'] );
|
||||
|
||||
$update[ $column ] = $url . $row['emo_set'] . '_' . $row['image'];
|
||||
/* The emoticon may have existed in a sub-folder */
|
||||
if ( mb_stripos( $row['image'], '/' ) !== FALSE )
|
||||
{
|
||||
/* Work out the path */
|
||||
$emo_path = explode( '/', $row['image'] );
|
||||
$emo_name = array_pop( $emo_path );
|
||||
|
||||
@copy( \IPS\ROOT_PATH . '/' . $publicPath . '/style_emoticons/' . $row['emo_set'] . '/' . implode( '/', $emo_path ) . '/' . $emo_name, $path . '/' . $row['emo_set'] . '_' . implode( '_', $emo_path ) . '_' . $emo_name );
|
||||
|
||||
$update[ $column ] = $url . $row['emo_set'] . '_' . implode( '_', $emo_path ) . '_' . $emo_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
@copy( \IPS\ROOT_PATH . '/' . $publicPath . '/style_emoticons/' . $row['emo_set'] . '/' . $row['image'], $path . '/' . $row['emo_set'] . '_' . $row['image'] );
|
||||
|
||||
$update[ $column ] = $url . $row['emo_set'] . '_' . $row['image'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3213,9 +3253,6 @@ DROP INDEX like_lookup_area"
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'ban,delete' ), array( 'conf_key=?', 'spm_option' ) );
|
||||
}
|
||||
|
||||
/* Update Search Engine setting - Sphinx needs new special setup for 4 */
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'mysql' ), array( 'conf_key=?', 'search_engine' ) );
|
||||
|
||||
/* Make sure license key does not have extra spaces at end */
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => trim( \IPS\Settings::i()->ipb_reg_number ) ), array( 'conf_key=?', 'ipb_reg_number' ) );
|
||||
|
||||
@@ -3344,6 +3381,14 @@ DROP INDEX like_lookup_area"
|
||||
\IPS\Db::i()->update( 'core_applications', $update, array( 'app_directory=?', 'gallery' ) );
|
||||
}
|
||||
|
||||
/* Update guest group access to site if required */
|
||||
if( \IPS\Settings::i()->force_login )
|
||||
{
|
||||
$group = \IPS\Member\Group::load( \IPS\Settings::i()->guest_group );
|
||||
$group->g_view_board = FALSE;
|
||||
$group->save();
|
||||
}
|
||||
|
||||
/* Disable cron task job */
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'task_use_cron' ) );
|
||||
|
||||
@@ -3780,8 +3825,6 @@ DROP INDEX like_lookup_area"
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentPosts', array( 'extension' => 'core_Reports' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentPosts', array( 'extension' => 'core_Modcp' ), 2 );
|
||||
|
||||
\IPS\Settings::i()->search_engine = 'mysql';
|
||||
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
|
||||
/* Recount content */
|
||||
|
||||
Reference in new issue
Block a user