Version 4.0.13.1
This commit is contained in:
1 parent
f9e857d255
commit
c6a86f0d9b
7517 files changed
+597400
-668041
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,197 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_view_approvers",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can view who approved files?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_bypass_revision",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can bypass revisions?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_view_downloads",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can view who downloaded files?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_throttling",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "IP.Downloads Speed Throttling kb",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_wait_period",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Seconds users must wait before download",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_restrictions",
|
||||
"type": "TEXT",
|
||||
"null": false,
|
||||
"default": "{}",
|
||||
"comment": "IP.Downloads Restrictions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_linked_files",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can submit URLs?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_import_files",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can import files from a path?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"9": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_members",
|
||||
{
|
||||
"name": "idm_block_submissions",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Blocked from submitting IP.Downloads files?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"10": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_bulk_submit",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can bulk upload?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"11": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_add_paid",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can submit paid files?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"12": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"core_groups",
|
||||
{
|
||||
"name": "idm_bypass_paid",
|
||||
"type": "TINYINT",
|
||||
"length": 1,
|
||||
"null": false,
|
||||
"default": 0,
|
||||
"comment": "Can download paid files without paying?",
|
||||
"unsigned": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"13": {
|
||||
"method": "insert",
|
||||
"params": [
|
||||
"core_permission_index",
|
||||
{
|
||||
"app": "downloads",
|
||||
"perm_type": "category",
|
||||
"perm_type_id": 1,
|
||||
"perm_view": "*",
|
||||
"perm_2": "*",
|
||||
"perm_3": "<%NO_GUESTS%>",
|
||||
"perm_4": "<%NO_GUESTS%>",
|
||||
"perm_5": "<%NO_GUESTS%>",
|
||||
"perm_6": "<%NO_GUESTS%>"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 30 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100002;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Fix SEO titles
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_categories', array( 'cname_furl' => null ) );
|
||||
\IPS\Db::i()->update( 'downloads_files', array( 'file_name_furl' => null ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Resetting downloads friendly URL titles";
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,170 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
"file_downloads"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"downloads_cfields",
|
||||
"cf_format",
|
||||
{
|
||||
"name": "cf_format",
|
||||
"type": "TEXT",
|
||||
"length": 0,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"downloads_comments",
|
||||
"comment_text"
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
"file_name"
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
"file_desc"
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"method": "dropIndex",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
"review_text"
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
"file_cost",
|
||||
{
|
||||
"name": "file_cost",
|
||||
"type": "TEXT",
|
||||
"length": 0,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": "",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
"file_renewal_price",
|
||||
{
|
||||
"name": "file_renewal_price",
|
||||
"type": "TEXT",
|
||||
"length": 0,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": "",
|
||||
"comment": "",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"9": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_favorites",
|
||||
true
|
||||
]
|
||||
},
|
||||
"10": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_filestorage",
|
||||
true
|
||||
]
|
||||
},
|
||||
"11": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_fileviews",
|
||||
true
|
||||
]
|
||||
},
|
||||
"12": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_mime",
|
||||
true
|
||||
]
|
||||
},
|
||||
"13": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_mimemask",
|
||||
true
|
||||
]
|
||||
},
|
||||
"14": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_mods",
|
||||
true
|
||||
]
|
||||
},
|
||||
"15": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_temp_records",
|
||||
true
|
||||
]
|
||||
},
|
||||
"16": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_upgrade_history",
|
||||
true
|
||||
]
|
||||
},
|
||||
"17": {
|
||||
"method": "dropTable",
|
||||
"params": [
|
||||
"downloads_urls",
|
||||
true
|
||||
]
|
||||
},
|
||||
"18": {
|
||||
"method": "dropColumn",
|
||||
"params": [
|
||||
"downloads_cfields",
|
||||
"cf_file_format"
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 Alpha 1 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 25 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100005;
|
||||
|
||||
/* 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.0.0 Alpha 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1
|
||||
* Fix downloads changelog
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$limit = 0;
|
||||
$did = 0;
|
||||
$perCycle = 500;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = (int) \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( 'b_id, b_changelog', 'downloads_filebackup', array( "b_changelog is not null and b_changelog != ''" ), 'b_id ASC', array( $limit, $perCycle ) ) as $backup )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
if( mb_strpos( $backup['b_changelog'], '<p' ) === FALSE AND mb_strpos( $backup['b_changelog'], '<ul' ) === FALSE )
|
||||
{
|
||||
$contents = explode( "\n", str_replace( "\r", '', $backup['b_changelog'] ) );
|
||||
$newContents = "<ul><li>" . implode( "</li><li>", $contents ) . "</li></ul>";
|
||||
|
||||
\IPS\Db::i()->update( 'downloads_filebackup', array( 'b_changelog' => $newContents ), array( 'b_id=?', $backup['b_id'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step1Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step1Count'] ) )
|
||||
{
|
||||
$_SESSION['_step1Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_filebackup', array( "b_changelog is not null and b_changelog != ''" ) )->first();
|
||||
}
|
||||
|
||||
return "Upgrading backup changelogs (Upgraded so far: " . ( ( $limit > $_SESSION['_step1Count'] ) ? $_SESSION['_step1Count'] : $limit ) . ' out of ' . $_SESSION['_step1Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2
|
||||
* Fix downloads changelog
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$limit = 0;
|
||||
$did = 0;
|
||||
$perCycle = 500;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = (int) \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( 'file_id, file_changelog', 'downloads_files', array( "file_changelog is not null and file_changelog != ''" ), 'file_id ASC', array( $limit, $perCycle ) ) as $file )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
if( mb_strpos( $file['file_changelog'], '<p' ) === FALSE AND mb_strpos( $file['file_changelog'], '<ul' ) === FALSE )
|
||||
{
|
||||
$contents = explode( "\n", str_replace( "\r", '', $file['file_changelog'] ) );
|
||||
$newContents = "<ul><li>" . implode( "</li><li>", $contents ) . "</li></ul>";
|
||||
|
||||
\IPS\Db::i()->update( 'downloads_files', array( 'file_changelog' => $newContents ), array( 'file_id=?', $file['file_id'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
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(*)', 'downloads_files', array( "file_changelog is not null and file_changelog != ''" ) )->first();
|
||||
}
|
||||
|
||||
return "Upgrading file changelogs (Upgraded so far: " . ( ( $limit > $_SESSION['_step2Count'] ) ? $_SESSION['_step2Count'] : $limit ) . ' out of ' . $_SESSION['_step2Count'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3
|
||||
* Fix currency
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
if( !isset( \IPS\Settings::i()->nexus_currency ) or !\IPS\Application::appIsEnabled( 'nexus', TRUE ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$limit = 0;
|
||||
$did = 0;
|
||||
$perCycle = 500;
|
||||
|
||||
if( isset( \IPS\Request::i()->extra ) )
|
||||
{
|
||||
$limit = (int) \IPS\Request::i()->extra;
|
||||
}
|
||||
|
||||
/* Try to prevent timeouts to the extent possible */
|
||||
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
|
||||
|
||||
foreach( \IPS\Db::i()->select( 'file_id, file_cost, file_renewal_price', 'downloads_files', array( "file_cost is not null and file_cost != ''" ), 'file_id ASC', array( $limit, $perCycle ) ) as $file )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
$update = array();
|
||||
|
||||
/* Base price */
|
||||
$costs = @json_decode( $file['file_cost'], TRUE );
|
||||
|
||||
if( !is_array( $costs ) and $file['file_cost'] )
|
||||
{
|
||||
$costs = array();
|
||||
|
||||
foreach( \IPS\nexus\Money::currencies() as $currency )
|
||||
{
|
||||
$costs[ $currency ] = array( 'amount' => $file['file_cost'], 'currency' => $currency );
|
||||
}
|
||||
|
||||
$update['file_cost'] = json_encode( $costs );
|
||||
}
|
||||
|
||||
/* Renewal price */
|
||||
$costs = @json_decode( $file['file_renewal_price'], TRUE );
|
||||
|
||||
if( !is_array( $costs ) )
|
||||
{
|
||||
$costs = array();
|
||||
|
||||
foreach( \IPS\nexus\Money::currencies() as $currency )
|
||||
{
|
||||
$costs[ $currency ] = array( 'amount' => $file['file_renewal_price'], 'currency' => $currency );
|
||||
}
|
||||
|
||||
$update['file_renewal_price'] = json_encode( $costs );
|
||||
}
|
||||
|
||||
if( count( $update ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_files', $update, array( 'file_id=?', $file['file_id'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step3Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
if( !isset( \IPS\Settings::i()->nexus_currency ) )
|
||||
{
|
||||
return "No file costs to update";
|
||||
}
|
||||
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step3Count'] ) )
|
||||
{
|
||||
$_SESSION['_step3Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( "file_cost is not null and file_cost != ''" ) )->first();
|
||||
}
|
||||
|
||||
return "Upgrading file costs (Upgraded so far: " . ( ( $limit > $_SESSION['_step3Count'] ) ? $_SESSION['_step3Count'] : $limit ) . ' out of ' . $_SESSION['_step3Count'] . ')';
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "changeColumn",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
"review_votes_data",
|
||||
{
|
||||
"name": "review_votes_data",
|
||||
"type": "TEXT",
|
||||
"length": 0,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": "",
|
||||
"comment": "JSON object containing data about who has voted helpful\/unhelpful ",
|
||||
"unsigned": false,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 RC 1 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
|
||||
* @subpackage Downloads
|
||||
* @since 3 Feb 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100011;
|
||||
|
||||
/* 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.0.0 RC 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1
|
||||
* Rebuild last poster data
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$perCycle = 50;
|
||||
$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( '*', 'downloads_categories', NULL, 'cid ASC', array( $limit, $perCycle ) ) as $category )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
$category = \IPS\downloads\Category::constructFromData( $category );
|
||||
$category->setLastComment();
|
||||
$category->save();
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step1Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step1Count'] ) )
|
||||
{
|
||||
$_SESSION['_step1Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories' )->first();
|
||||
}
|
||||
|
||||
return "Rebuilding last poster data for download categories (Upgraded so far: " . ( ( $limit > $_SESSION['_step1Count'] ) ? $_SESSION['_step1Count'] : $limit ) . ' out of ' . $_SESSION['_step1Count'] . ')';
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 RC 1 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
|
||||
* @subpackage Downloads
|
||||
* @since 5 Feb 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100012;
|
||||
|
||||
/* 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.0.0 RC 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1
|
||||
* Fixing custom fields
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_cfields' ) as $field )
|
||||
{
|
||||
$update = array();
|
||||
|
||||
switch( $field['cf_type'] )
|
||||
{
|
||||
case 'input':
|
||||
$update['cf_type'] = 'Text';
|
||||
break;
|
||||
|
||||
case 'textarea':
|
||||
$update['cf_type'] = 'TextArea';
|
||||
break;
|
||||
|
||||
case 'drop':
|
||||
$update['cf_type'] = 'Select';
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
$update['cf_type'] = 'Radio';
|
||||
break;
|
||||
|
||||
case 'cbox':
|
||||
$update['cf_type'] = 'Select';
|
||||
$update['cf_multiple'] = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( count( $update ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_cfields', $update, 'cf_id=' . $field['cf_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Fixing downloads custom fields";
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 RC 1 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
|
||||
* @subpackage Downloads
|
||||
* @since 9 Feb 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100013;
|
||||
|
||||
/* 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.0.0 RC 1 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1
|
||||
* Fixing custom fields
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_cfields' ) as $field )
|
||||
{
|
||||
if( $field['cf_type'] == 'Select' )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->dropIndex( 'downloads_ccontent', "field_" . $field['cf_id'] );
|
||||
\IPS\Db::i()->dropColumn( 'downloads_ccontent', "field_" . $field['cf_id'] );
|
||||
}
|
||||
catch ( \IPS\Db\Exception $e )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
\IPS\Db::i()->addColumn( 'downloads_ccontent', array( 'name' => "field_" . $field['cf_id'], 'type' => 'TEXT' ) );
|
||||
\IPS\Db::i()->addIndex( 'downloads_ccontent', array( 'type' => 'key', 'name' => "field_" . $field['cf_id'], 'columns' => array( "field_" . $field['cf_id'] ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Fixing downloads custom fields";
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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 15 Jan 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100015;
|
||||
|
||||
/* 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.0.0 RC 2 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Finish - This is run after all apps have been upgraded
|
||||
*
|
||||
* @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)
|
||||
* @note We opted not to let users run this immediately during the upgrade because of potential issues (it taking a long time and users stopping it or getting frustrated) but we can revisit later
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildItems', array( 'class' => 'IPS\downloads\File' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\downloads\File', 'count' => 0 ), 4, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.0 RC 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
|
||||
* @subpackage Blog
|
||||
* @since 5 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100018;
|
||||
|
||||
/* 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.0.0 RC 5 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
|
||||
/**
|
||||
* Make sure all theme settings are applied to every theme.
|
||||
*
|
||||
* @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', 'RebuildReputationIndex', array( 'class' => 'IPS\downloads\File' ), 4 );
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationIndex', array( 'class' => 'IPS\downloads\File\Comment' ), 4 );
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationIndex', array( 'class' => 'IPS\downloads\File\Review' ), 4 );
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "ip_lookup",
|
||||
"columns": [
|
||||
"file_ipaddress"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"downloads_comments",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "comment_approved",
|
||||
"columns": [
|
||||
"comment_open"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addIndex",
|
||||
"params": [
|
||||
"downloads_reviews",
|
||||
{
|
||||
"type": "key",
|
||||
"name": "review_approved",
|
||||
"columns": [
|
||||
"review_approved"
|
||||
],
|
||||
"length": [
|
||||
null
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"name": "file_unapproved_comments",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"name": "file_hidden_comments",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"name": "file_unapproved_reviews",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"method": "addColumn",
|
||||
"params": [
|
||||
"downloads_files",
|
||||
{
|
||||
"name": "file_hidden_reviews",
|
||||
"type": "INT",
|
||||
"length": 10,
|
||||
"decimals": null,
|
||||
"values": [],
|
||||
"allow_null": true,
|
||||
"default": null,
|
||||
"comment": "",
|
||||
"unsigned": true,
|
||||
"zerofill": false,
|
||||
"auto_increment": false,
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Blog
|
||||
* @since 5 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100028;
|
||||
|
||||
/* 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.0.5 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
|
||||
/**
|
||||
* Make sure all theme settings are applied to every theme.
|
||||
*
|
||||
* @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\core\Setup\Upgrade::repairFileUrls('downloads');
|
||||
\IPS\Task::queue( 'core', 'RebuildContentImages', array( 'class' => 'IPS\downloads\File' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContentImages', array( 'class' => 'IPS\downloads\File\Comment' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildContentImages', array( 'class' => 'IPS\downloads\File\Review' ), 3, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentImages', array( 'extension' => 'downloads_Categories' ), 3, array( 'extension' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.9 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 19 Jun 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100035;
|
||||
|
||||
/* 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.0.9 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Update widgets
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$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'] == 'recentFiles' )
|
||||
{
|
||||
$widgets[ $k ]['key'] = 'fileFeed';
|
||||
if ( isset( $widgets[ $k ]['configuration']['number_to_show'] ) )
|
||||
{
|
||||
$widgets[ $k ]['configuration']['widget_feed_show'] = $widgets[ $k ]['configuration']['number_to_show'];
|
||||
unset( $widgets[ $k ]['configuration']['number_to_show'] );
|
||||
}
|
||||
|
||||
$update = TRUE;
|
||||
}
|
||||
|
||||
if ( $update )
|
||||
{
|
||||
\IPS\Db::i()->update( $table, array( $widgetsColumn => json_encode( $widgets ) ), $whereClause );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "delete",
|
||||
"params": [
|
||||
"core_widgets",
|
||||
[
|
||||
"app=? AND `key`=?",
|
||||
"downloads",
|
||||
"recentFiles"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"1": {
|
||||
"method": "update",
|
||||
"params": [
|
||||
"downloads_files_records",
|
||||
"record_thumb=record_location",
|
||||
"record_thumb IS NULL OR record_thumb=''"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.13 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 31 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_100044;
|
||||
|
||||
/* 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.0.13 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Step 1
|
||||
* Convert Ratings
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$perCycle = 1000;
|
||||
$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( '*', 'downloads_files', array( 'file_votes IS NOT NULL' ), 'file_id ASC', array( $limit, $perCycle ) ) as $file )
|
||||
{
|
||||
if( $cutOff !== null AND time() >= $cutOff )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
|
||||
$did++;
|
||||
|
||||
$votes = unserialize( $file['file_votes'] );
|
||||
$voteCount = 0;
|
||||
|
||||
if ( is_array( $votes ) and count( $votes ) )
|
||||
{
|
||||
foreach( $votes as $member => $rating )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'downloads_reviews', array(
|
||||
'review_fid' => $file['file_id'],
|
||||
'review_mid' => $member,
|
||||
'review_rating' => $rating,
|
||||
) );
|
||||
|
||||
$voteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'downloads_files', array( 'file_reviews' => $file['file_reviews'] + $voteCount ), array( "file_id=?", $file['file_id'] ) );
|
||||
}
|
||||
|
||||
if( $did )
|
||||
{
|
||||
return ( $limit + $did );
|
||||
}
|
||||
else
|
||||
{
|
||||
unset( $_SESSION['_step1Count'] );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
|
||||
|
||||
if( !isset( $_SESSION['_step1Count'] ) )
|
||||
{
|
||||
$_SESSION['_step1Count'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( 'file_votes IS NOT NULL' ) )->first();
|
||||
}
|
||||
|
||||
return "Converting file ratings (Updated so far: " . ( ( $limit > $_SESSION['_step1Count'] ) ? $_SESSION['_step1Count'] : $limit ) . ' out of ' . $_SESSION['_step1Count'] . ')';
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_categories DROP INDEX cposition, ADD INDEX position_order ( cparent , cposition );";
|
||||
$SQL[] = "ALTER TABLE downloads_downloads ADD INDEX ( dmid );";
|
||||
$SQL[] = "ALTER TABLE downloads_comments CHANGE comment_date comment_date INT NOT NULL DEFAULT '0', CHANGE comment_edit_time comment_edit_time INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_favorites ADD INDEX ( fmid ), CHANGE fupdated fupdated INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_filebackup CHANGE b_backup b_backup INT NOT NULL DEFAULT '0', CHANGE b_updated b_updated INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files CHANGE file_submitted file_submitted INT NOT NULL DEFAULT '0', file_updated file_updated INT NOT NULL DEFAULT '0', file_approvedon file_approvedon INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_sessions ADD INDEX ( dsess_start ), CHANGE dsess_start dsess_start INT NOT NULL DEFAULT '0', CHANGE dsess_end dsess_end INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_temp_records CHANGE record_added record_added INT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_urls ADD INDEX ( url_expires ), CHANGE url_created url_created INT NOT NULL DEFAULT '0', CHANGE url_expires url_expires INT NOT NULL DEFAULT '0'";
|
||||
|
||||
$SQL[] = "delete FROM core_sys_conf_settings WHERE conf_key='idm_guest_report';";
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_21001;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 21001 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD file_cost FLOAT NOT NULL DEFAULT '0.00';";
|
||||
$SQL[] = "ALTER TABLE core_groups ADD idm_bypass_paid TINYINT( 1 ) NOT NULL DEFAULT 0, ADD idm_add_paid TINYINT( 1 ) NOT NULL DEFAULT 0;";
|
||||
$SQL[] = "delete FROM core_sys_conf_settings WHERE conf_key='idm_guest_report';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_22000;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 22000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD file_nexus TEXT NOT NULL DEFAULT '';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_22006;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 22006 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "DROP TABLE downloads_ip2ext;";
|
||||
$SQL[] = "ALTER TABLE downloads_downloads DROP dcountry;";
|
||||
$SQL[] = "ALTER TABLE downloads_cfields ADD cf_format TEXT NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_comments ADD comment_author VARCHAR( 255 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE core_groups ADD idm_report_files TINYINT( 1 ) NOT NULL DEFAULT '0', ADD idm_view_downloads TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "UPDATE core_groups SET idm_report_files=1;";
|
||||
$SQL[] = "ALTER TABLE downloads_mods ADD modchangeauthor TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files DROP INDEX file_open , ADD INDEX file_open ( file_open , file_cat , file_submitted ), ADD file_version VARCHAR( 32 ) NULL DEFAULT NULL , ADD file_changelog TEXT NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_filebackup ADD b_version VARCHAR( 32 ) NULL DEFAULT NULL , ADD b_changelog TEXT NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_files_records ADD record_default TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
|
||||
|
||||
$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key IN('idm_allow_emaillinks', 'idm_comment_display', 'idm_guest_report');";
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_23000;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 23000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert follows
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$members = array();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_favorites' ) as $favorite )
|
||||
{
|
||||
$members[ $favorite['ffid'] ][ $favorite['fmid'] ] = array(
|
||||
'follow_rel_id' => $favorite['ffid'],
|
||||
'follow_member_id' => $favorite['fmid'],
|
||||
'follow_notify_do' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
foreach( \IPS\Db::i()->select( 'file_id, file_sub_mems', 'downloads_files', "file_sub_mems != '' AND file_sub_mems IS NOT NULL" ) as $file )
|
||||
{
|
||||
$_subscriptions = explode( ',', trim( $r['file_sub_mems'], ',' ) );
|
||||
|
||||
if( count( $_subscriptions ) )
|
||||
{
|
||||
foreach( $_subscriptions as $mid )
|
||||
{
|
||||
if( isset( $members[ $file['file_id'] ][ $mid ]) )
|
||||
{
|
||||
$members[ $file['file_id'] ][ $mid ]['follow_notify_do'] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$members[ $file['file_id'] ][ $mid ] = array(
|
||||
'follow_rel_id' => $file['file_id'],
|
||||
'follow_member_id' => $mid,
|
||||
'follow_notify_do' => 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $members ) )
|
||||
{
|
||||
foreach( $members as $file => $_members )
|
||||
{
|
||||
foreach( $_members as $member )
|
||||
{
|
||||
if( !$member['follow_member_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->insert( 'core_follow', array(
|
||||
'follow_app' => 'downloads',
|
||||
'follow_area' => 'files',
|
||||
'follow_rel_id' => $member['follow_rel_id'],
|
||||
'follow_member_id' => $member['follow_member_id'],
|
||||
'follow_is_anon' => 0,
|
||||
'follow_added' => time(),
|
||||
'follow_notify_do' => $member['follow_notify_do'],
|
||||
'follow_notify_freq' => 'immediate',
|
||||
'follow_visible' => 1,
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
if( \IPS\Db::i()->checkForColumn( 'downloads_files', 'file_meta' ) )
|
||||
{
|
||||
\IPS\Db::i()->dropColumn( 'downloads_files', 'file_meta' );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->dropTable( 'downloads_favorites' );
|
||||
\IPS\Db::i()->dropColumn( 'downloads_files', 'file_sub_mems' );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE core_groups ADD idm_bypass_revision TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_temp_records ADD INDEX ( record_added );";
|
||||
$SQL[] = "ALTER TABLE downloads_downloads ADD INDEX ( dtime );";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_23001;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 23001 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD COLUMN file_renewal_term INT(5) NOT NULL DEFAULT 0;";
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD COLUMN file_renewal_units CHAR(1) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD COLUMN file_renewal_price FLOAT NOT NULL DEFAULT '0.00';";
|
||||
$SQL[] = "ALTER TABLE downloads_mods ADD modusefeature TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD file_featured TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( file_featured );";
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD file_pinned TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_mods ADD modcanpin TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files ADD file_comments INT NOT NULL DEFAULT '0';";
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_23003;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 23003 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update comment count
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( 'COUNT(*) as comments, comment_fid', 'downloads_comments', NULL, NULL, NULL, 'comment_fid' ) as $file )
|
||||
{
|
||||
$comments[ $file['comment_fid'] ] = $file['comments'];
|
||||
}
|
||||
|
||||
if( count( $comments ) )
|
||||
{
|
||||
foreach( $comments as $fileId => $commentCount )
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_files', array( 'file_comments' => $commentCount ), array( 'file_id=?', $fileId ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_temp_records ADD record_default TINYINT( 1 ) NOT NULL DEFAULT '0';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_23006;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 23006 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IP.Board vVERSION_NUMBER
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2009 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Downloads upgrade */
|
||||
|
||||
$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key IN( 'idm_enablerandom' );";
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_comments CHANGE ip_address ip_address VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_downloads CHANGE dip dip VARCHAR( 46 ) NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files CHANGE file_ipaddress file_ipaddress VARCHAR( 46 ) NOT NULL DEFAULT '0',
|
||||
DROP INDEX file_submitter,
|
||||
ADD INDEX file_submitter ( file_submitter, file_open, file_updated );";
|
||||
$SQL[] = "ALTER TABLE downloads_sessions CHANGE dsess_ip dsess_ip VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
$SQL[] = "ALTER TABLE downloads_urls CHANGE url_ip url_ip VARCHAR( 46 ) NULL DEFAULT NULL;";
|
||||
|
||||
$SQL[] = "UPDATE core_applications SET app_title='Downloads' WHERE app_directory='downloads';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_24000;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 24000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IP.Board vVERSION_NUMBER
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2009 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* Downloads upgrade */
|
||||
|
||||
$SQL[] = "UPDATE core_sys_conf_settings SET conf_value='disk' WHERE conf_key='idm_filestorage' AND conf_value IN ('web','nonweb');";
|
||||
$SQL[] = "UPDATE downloads_files_records SET record_storagetype='disk' WHERE record_storagetype IN ('web','nonweb');";
|
||||
$SQL[] = "ALTER TABLE downloads_files_records CHANGE record_storagetype record_storagetype varchar(24) NOT NULL default 'disk';";
|
||||
|
||||
$SQL[] = "ALTER TABLE core_groups ADD idm_throttling INT NOT NULL DEFAULT '0',
|
||||
ADD idm_wait_period INT NOT NULL DEFAULT '0';";
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_categories ADD ctags_disabled TINYINT NOT NULL DEFAULT '0',
|
||||
ADD ctags_noprefixes TINYINT NOT NULL DEFAULT '0',
|
||||
ADD ctags_predefined TEXT NULL DEFAULT NULL;";
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_comments DROP INDEX comment_fid,
|
||||
ADD INDEX comment_fid ( comment_fid , comment_date );";
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_files DROP INDEX file_cat,
|
||||
ADD INDEX file_cat ( file_cat , file_updated );";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_25000;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 25000 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IP.Board vVERSION_NUMBER
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2009 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Downloads upgrade */
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_files CHANGE file_size file_size BIGINT NOT NULL DEFAULT '0';";
|
||||
$SQL[] = "ALTER TABLE downloads_files_records CHANGE record_size record_size BIGINT NOT NULL DEFAULT '0';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_25004;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 25004 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Downloads upgrade */
|
||||
|
||||
$SQL[] = "ALTER TABLE downloads_downloads CHANGE dsize dsize BIGINT NOT NULL DEFAULT '0';";
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 24 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_25005;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Conversion from 3.0
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
\IPS\core\Setup\Upgrade::runLegacySql( 'downloads', 25005 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief 4.0.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
|
||||
* @subpackage Downloads
|
||||
* @since 19 Nov 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\setup\upg_40000;
|
||||
|
||||
/* 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.0.0 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
{
|
||||
/**
|
||||
* Upgrade categories
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_categories' )->join( 'core_permission_index', array( 'app=? and perm_type=? and perm_type_id=downloads_categories.cid', 'downloads', 'cat' ) ) as $category )
|
||||
{
|
||||
$options = unserialize( $category['coptions'] );
|
||||
/* We make a guess as to whether approval should be required since it is no longer per-permission mask */
|
||||
$approval = ( !$category['perm_7'] or $category['perm_7'] == ',4,' ) ? 1 : 0;
|
||||
$cid = $category['cid'];
|
||||
$name = $category['cname'];
|
||||
$desc = $category['cdesc'];
|
||||
|
||||
$category = \IPS\downloads\Category::constructFromData( $category );
|
||||
|
||||
$category->bitoptions['allowss'] = ( isset( $options['opt_allowss'] ) ) ? $options['opt_allowss'] : 0;
|
||||
$category->bitoptions['reqss'] = ( isset( $options['opt_reqss'] ) ) ? $options['opt_reqss'] : 0;
|
||||
$category->bitoptions['comments'] = ( isset( $options['opt_comments'] ) ) ? $options['opt_comments'] : 0;
|
||||
$category->bitoptions['moderation'] = $approval;
|
||||
$category->bitoptions['comment_moderation'] = \IPS\Settings::i()->idm_comment_approval;
|
||||
$category->bitoptions['moderation_edits'] = !\IPS\Settings::i()->idm_allow_autoedit;
|
||||
$category->bitoptions['submitter_log'] = \IPS\Settings::i()->submitter_view_dl;
|
||||
$category->bitoptions['reviews_download'] = \IPS\Settings::i()->must_dl_rate;
|
||||
$category->bitoptions['topic_delete'] = ( isset( $options['opt_topicd'] ) ) ? $options['opt_topicd'] : 0;
|
||||
$category->bitoptions['topic_screenshot'] = ( isset( $options['opt_topicss'] ) ) ? $options['opt_topicss'] : 0;
|
||||
|
||||
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$cid}", trim( $name ) );
|
||||
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$cid}_npv", $options['opt_noperm_view'] ? \IPS\Text\Parser::parseStatic( $options['opt_noperm_view'], TRUE, NULL, NULL, TRUE, TRUE, TRUE ) : '' );
|
||||
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$cid}_npd", $options['opt_noperm_dl'] ? \IPS\Text\Parser::parseStatic( $options['opt_noperm_dl'], TRUE, NULL, NULL, TRUE, TRUE, TRUE ) : '' );
|
||||
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$cid}_desc", \IPS\Text\Parser::parseStatic( $desc, TRUE, NULL, NULL, TRUE, TRUE, TRUE ) );
|
||||
|
||||
$category->types = '';
|
||||
$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->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;
|
||||
$category->topic_prefix = ( isset( $options['opt_topicp'] ) ) ? $options['opt_topicp'] : 0;
|
||||
$category->topic_suffix = ( isset( $options['opt_topics'] ) ) ? $options['opt_topics'] : 0;
|
||||
|
||||
try
|
||||
{
|
||||
$latestFile = \IPS\Db::i()->select( '*', 'downloads_files', array( 'file_open=? and file_cat=?', 1, $cid ), 'file_submitted DESC', array( 0, 1 ) )->first();
|
||||
|
||||
$category->last_file_id = $latestFile['file_id'];
|
||||
$category->last_file_date = $latestFile['file_submitted'];
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$category->last_file_id = 0;
|
||||
$category->last_file_date = 0;
|
||||
}
|
||||
|
||||
$category->save();
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_permission_index', array( 'perm_type' => 'category' ), array( 'app=?', 'downloads' ) );
|
||||
\IPS\Db::i()->dropColumn( 'downloads_categories', array( 'coptions', 'cname' ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step1CustomTitle()
|
||||
{
|
||||
return "Upgrading download manager categories";
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom field translations
|
||||
*
|
||||
* @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( '*', 'downloads_cfields' ) as $field )
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', "downloads_field_{$field['cf_id']}", $field['cf_title'] );
|
||||
\IPS\Lang::saveCustom( 'core', "downloads_field_{$field['cf_id']}_desc", $field['cf_desc'] );
|
||||
|
||||
$update = array();
|
||||
|
||||
switch( $field['cf_type'] )
|
||||
{
|
||||
case 'input':
|
||||
$update['cf_type'] = 'Text';
|
||||
break;
|
||||
|
||||
case 'textarea':
|
||||
$update['cf_type'] = 'TextArea';
|
||||
break;
|
||||
|
||||
case 'drop':
|
||||
$update['cf_type'] = 'Select';
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
$update['cf_type'] = 'Radio';
|
||||
break;
|
||||
|
||||
case 'cbox':
|
||||
$update['cf_type'] = 'Select';
|
||||
$update['cf_multiple'] = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
$update['cf_type'] = 'Text';
|
||||
break;
|
||||
}
|
||||
|
||||
if( $field['cf_type'] === 'Textarea' )
|
||||
{
|
||||
$update['cf_type'] = 'TextArea';
|
||||
}
|
||||
|
||||
/* Fix the options */
|
||||
if( $field['cf_content'] )
|
||||
{
|
||||
$options = explode( '|', $field['cf_content'] );
|
||||
$newOptions = array();
|
||||
|
||||
foreach( $options as $option )
|
||||
{
|
||||
list( $k, $v ) = explode( '=', $option );
|
||||
$newOptions[] = $v;
|
||||
}
|
||||
|
||||
if( !isset( $_SESSION['pfieldsd'] ) )
|
||||
{
|
||||
$_SESSION['pfieldsd'] = array();
|
||||
}
|
||||
|
||||
$_SESSION['pfieldsd'][ $field['cf_id'] ] = $field['cf_id'];
|
||||
$update['cf_content'] = json_encode( $newOptions );
|
||||
}
|
||||
|
||||
if( count( $update ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_cfields', $update, 'cf_id=' . $field['cf_id'] );
|
||||
}
|
||||
|
||||
/* Indexes are needed, otherwise you get an error if you try to edit the custom field later */
|
||||
\IPS\Db::i()->addIndex( 'downloads_ccontent', array( 'name' => 'field_' . $field['cf_id'], 'type' => 'key', 'columns' => array( 'field_' . $field['cf_id'] ), 'length' => array( 255 ) ) );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->dropColumn( 'downloads_cfields', array( 'cf_title', 'cf_desc' ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step2CustomTitle()
|
||||
{
|
||||
return "Upgrading download manager custom fields";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix watermark path
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
if( !isset( $_SESSION['pfieldsd'] ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$update = array();
|
||||
|
||||
foreach( $_SESSION['pfieldsd'] as $fieldId )
|
||||
{
|
||||
$update[] = "field_{$fieldId}=TRIM( BOTH ',' FROM field_{$fieldId} )";
|
||||
}
|
||||
|
||||
if( count( $update ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'downloads_ccontent', implode( ", ", $update ) );
|
||||
}
|
||||
|
||||
unset( $_SESSION['pfieldsd'] );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step3CustomTitle()
|
||||
{
|
||||
if( !isset( $_SESSION['pfieldsd'] ) )
|
||||
{
|
||||
return "No custom field data needs to be updated";
|
||||
}
|
||||
|
||||
return "Updating custom file fields";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix watermark path
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
$setting = \IPS\Db::i()->select( '*', 'core_sys_conf_settings', "conf_key='idm_watermarkpath'" )->first();
|
||||
|
||||
if( $setting['conf_value'] )
|
||||
{
|
||||
$pathBits = explode( '/', $setting['conf_value'] );
|
||||
$fileName = array_pop( $pathBits );
|
||||
|
||||
try
|
||||
{
|
||||
$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' ) );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), array( 'conf_key=?', '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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom title for this step
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function step4CustomTitle()
|
||||
{
|
||||
return "Fixing watermark configuration";
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish - This is run after all apps have been upgraded
|
||||
*
|
||||
* @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)
|
||||
* @note We opted not to let users run this immediately during the upgrade because of potential issues (it taking a long time and users stopping it or getting frustrated) but we can revisit later
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\downloads\File' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\downloads\File\Comment' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\downloads\File\Review' ), 2 );
|
||||
\IPS\Task::queue( 'core', 'RebuildNonContentPosts', array( 'extension' => 'downloads_Categories' ), 2 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user