Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.2.2 Beta 1 Upgrade Code
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 26 Jul 2017
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_102005;
|
||||
|
||||
/* 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.2.2 Beta 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Recount containers and repair custom field URL's
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
$file = new \IPS\downloads\extensions\core\FileStorage\FileField;
|
||||
\IPS\Task::queue( 'core', 'RepairFileUrls', array( 'storageExtension' => 'filestorage__downloads_FileField', 'count' => $file->count() ), 1 );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"downloads_comments",
|
||||
"comment_approved",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "comment_approved",
|
||||
"columns": [
|
||||
"comment_open",
|
||||
"comment_date"
|
||||
],
|
||||
"length": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
"review_approved",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "review_approved",
|
||||
"columns": [
|
||||
"review_approved",
|
||||
"review_date"
|
||||
],
|
||||
"length": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"downloads_downloads",
|
||||
"dsize",
|
||||
{
|
||||
"name": "dsize",
|
||||
"type": "BIGINT",
|
||||
"length": 20,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": false,
|
||||
"default": "0",
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
{
|
||||
"name": "review_author_response",
|
||||
"type": "MEDIUMTEXT",
|
||||
"length": null,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"downloads_comments",
|
||||
"comment_author",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "comment_mid",
|
||||
"columns": [
|
||||
"comment_mid"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"downloads_comments",
|
||||
"comment_mid",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "comment_mid",
|
||||
"columns": [
|
||||
"comment_mid",
|
||||
"comment_date"
|
||||
],
|
||||
"length": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "changeIndex",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
"review_mid",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "review_mid",
|
||||
"columns": [
|
||||
"review_mid",
|
||||
"review_date"
|
||||
],
|
||||
"length": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"downloads_downloads",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "dip",
|
||||
"columns": [
|
||||
"dip"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"name": "file_purchasable",
|
||||
"type": "BIT",
|
||||
"length": 1,
|
||||
"decimals": null,
|
||||
"values": null,
|
||||
"allow_null": false,
|
||||
"default": "1",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@ class _Upgrade
|
||||
}
|
||||
|
||||
\IPS\Db::i()->insert( 'core_follow', array(
|
||||
'follow_id' => md5( 'downloads;files;' . $member['follow_rel_id'] . ';' . $member['follow_member_id'] ),
|
||||
'follow_app' => 'downloads',
|
||||
'follow_area' => 'files',
|
||||
'follow_rel_id' => $member['follow_rel_id'],
|
||||
|
||||
@@ -75,7 +75,7 @@ class _Upgrade
|
||||
$category->sortorder = 'file_' . \str_ireplace( array( ' DESC', ' ASC' ), '', $options['opt_sortorder'] );
|
||||
$category->maxfile = $options['opt_maxfile'] ?: null;
|
||||
$category->maxss = $options['opt_maxss'] ?: null;
|
||||
$category->maxdims = ( $options['opt_thumb_x'] ) ? $options['opt_thumb_x'] . 'x' . $options['opt_thumb_x'] : NULL;
|
||||
$category->maxdims = NULL; // We purposefully don't retain the `opt_thumb_x` setting, since that is intended for thumbnails only.
|
||||
$category->versioning = \IPS\Settings::i()->idm_versioning ? NULL : 0;
|
||||
$category->log = \IPS\Settings::i()->idm_logalldownloads ? ( \IPS\Settings::i()->idm_log_prune ?: NULL ) : 0;
|
||||
$category->forum_id = ( isset( $options['opt_topicf'] ) ) ? $options['opt_topicf'] : 0;
|
||||
@@ -294,19 +294,17 @@ class _Upgrade
|
||||
{
|
||||
$url = \IPS\File::create( 'downloads_Screenshots', $fileName, file_get_contents( $setting['conf_value'] ), NULL, TRUE, NULL, FALSE );
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $url ), array( 'conf_key=?', 'idm_watermarkpath' ) );
|
||||
\IPS\Settings::i()->changeValues( array( 'idm_watermarkpath' => $url ) );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), array( 'conf_key=?', 'idm_watermarkpath' ) );
|
||||
\IPS\Settings::i()->changeValues( array( 'idm_watermarkpath' => '' ) );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'core_sys_conf_settings', "conf_key IN ( 'idm_screenshot_url', 'idm_filestorage', 'idm_localfilepath', 'idm_localsspath', 'idm_remoteport', 'idm_remotessurl',
|
||||
'idm_remotefileurl', 'idm_filestorage', 'idm_remoteurl', 'idm_remoteuser', 'idm_remotepass', 'idm_remotesspath', 'idm_remotefilepath' )" );
|
||||
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -394,6 +392,61 @@ class _Upgrade
|
||||
|
||||
return "Updating default screenshots (Updated so far: " . ( ( $limit > $_SESSION['_step5Count_40000_downloads'] ) ? $_SESSION['_step5Count_40000_downloads'] : $limit ) . ' out of ' . $_SESSION['_step5Count_40000_downloads'] . ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixing database-storage files
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
/* The only files in core_files at this point would be from Downloads database file storage */
|
||||
if( \IPS\Db::i()->select( 'COUNT(*)', 'core_files' )->first() )
|
||||
{
|
||||
$offset = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
$select = \IPS\Db::i()->select( '*', 'core_files', NULL, 'id', array( $offset, 25 ) );
|
||||
if ( count( $select ) )
|
||||
{
|
||||
foreach ( $select as $row )
|
||||
{
|
||||
/* The MySQL FROM_BASE64() function uses a slightly different ruleset than PHP, so we have to do this in PHP */
|
||||
\IPS\Db::i()->update( 'core_files', array( 'contents' => base64_decode( $row['contents'] ) ), array( 'id=?', $row['id'] ) );
|
||||
}
|
||||
|
||||
return $offset + 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step6Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step6CustomTitle()
|
||||
{
|
||||
/* Do we even have any to convert? */
|
||||
if( !\IPS\Db::i()->select( 'COUNT(*)', 'core_files' )->first() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step6Count'] ) )
|
||||
{
|
||||
$_SESSION['_step6Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_files' )->first();
|
||||
}
|
||||
|
||||
return "Updating database-stored files (Upgraded so far: " . ( ( $limit > $_SESSION['_step6Count'] ) ? $_SESSION['_step6Count'] : $limit ) . ' out of ' . $_SESSION['_step6Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish - This is run after all apps have been upgraded
|
||||
|
||||
Reference in new issue
Block a user