Version 4.0.13.1

This commit is contained in:
Neo committed 2025-12-19 04:57:54 -08:00
1 parent f9e857d255
commit c6a86f0d9b
7517 files changed
+597400 -668041

No files matched your search

Whitespace-only changes.
@@ -0,0 +1,52 @@
<?php
$SQL = array();
/* Lets drop some old tables and fields */
if ( \IPS\Db::i()->checkForTable( 'gallery_form_fields' ) )
{
$SQL[] = "DROP TABLE gallery_form_fields;";
}
if ( \IPS\Db::i()->checkForTable( 'gallery_media_types' ) )
{
$SQL[] = "DROP TABLE gallery_media_types;";
}
if ( \IPS\Db::i()->checkForColumn( 'gallery_albums_main', 'album_g_password' ) )
{
$SQL[] = "ALTER TABLE gallery_albums_main DROP album_g_password;";
}
/* This is for Gallery 5 - get rid of the categories table if it still exists to prevent an SQL error */
if ( \IPS\Db::i()->checkForTable( 'gallery_categories' ) )
{
$SQL[] = "DROP TABLE gallery_categories;";
}
/* Moved here from 40007 */
if ( \IPS\Db::i()->checkForTable( 'gallery_image_views' ) )
{
$SQL[] = "DROP TABLE gallery_image_views";
}
/* Need this query here to prevent driver errors upgrading from 4.0.x */
if ( !\IPS\Db::i()->checkForColumn( 'gallery_albums_main', 'album_position' ) )
{
$SQL[] = "ALTER TABLE gallery_albums_main ADD album_position INT(10) NOT NULL DEFAULT 0;";
}
$SQL[] = "ALTER TABLE gallery_albums_main ADD album_detail_default INT(1) unsigned NOT NULL DEFAULT 0;";
/* Fix wrong ratings */
$SQL[] = "UPDATE gallery_images SET rating=ROUND(ratings_total/ratings_count) WHERE ratings_total>0 AND ratings_count>0 AND rating=0;";
/* Re-add watermark */
$SQL[] = "ALTER TABLE gallery_albums_main ADD album_watermark INT(1) unsigned NOT NULL DEFAULT 0;";
$SQL[] = "ALTER TABLE gallery_images ADD original_file_name varchar(255) NULL DEFAULT NULL;";
$SQL[] = "ALTER TABLE gallery_images_uploads ADD upload_file_name_original VARCHAR(255) NULL DEFAULT NULL;";
/* Sometimes g_gallery_use is missing from old upgrades */
if ( !\IPS\Db::i()->checkForColumn( 'core_groups', 'g_gallery_use' ) )
{
$SQL[] = "ALTER TABLE core_groups ADD g_gallery_use TINYINT( 1 ) NOT NULL DEFAULT '1';";
}
@@ -0,0 +1,152 @@
<?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 Gallery
* @since 24 Oct 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\setup\upg_40009;
/* 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( 'gallery', 40009 );
return TRUE;
}
/**
* Convert albums
*
* @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()
{
if( \IPS\Db::i()->checkForTable( 'gallery_subscriptions' ) )
{
foreach( \IPS\Db::i()->select( '*', 'gallery_subscriptions', "sub_type='album'" ) as $subscription )
{
$followId = md5( 'gallery;albums;' . $subscription['sub_toid'] . ';' . $subscription['sub_mid'] );
\IPS\Db::i()->insert( 'core_follow', array(
'follow_id' => $followId,
'follow_app' => 'gallery',
'follow_area' => 'albums',
'follow_rel_id' => $subscription['sub_toid'],
'follow_member_id' => $subscription['sub_mid'],
'follow_is_anon' => 0,
'follow_added' => time(),
'follow_notify_do' => 1,
'follow_notify_freq' => 'immediate',
'follow_visible' => 1,
) );
}
}
return TRUE;
}
/**
* Convert favorites
*
* @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()
{
$perCycle = 500;
$did = 0;
$limit = intval( \IPS\Request::i()->extra );
if( \IPS\Db::i()->checkForTable( 'gallery_subscriptions' ) )
{
foreach( \IPS\Db::i()->select( '*', 'gallery_subscriptions', "sub_type='image'", 'sub_id ASC', array( $limit, $perCycle ) ) as $subscription )
{
$did++;
$followId = md5( 'gallery;images;' . $subscription['sub_toid'] . ';' . $subscription['sub_mid'] );
\IPS\Db::i()->insert( 'core_follow', array(
'follow_id' => $followId,
'follow_app' => 'gallery',
'follow_area' => 'images',
'follow_rel_id' => $subscription['sub_toid'],
'follow_member_id' => $subscription['sub_mid'],
'follow_is_anon' => 0,
'follow_added' => time(),
'follow_notify_do' => 1,
'follow_notify_freq' => 'immediate',
'follow_visible' => 1,
) );
}
}
if( $did )
{
return ( $limit + $did );
}
else
{
return TRUE;
}
}
/**
* Convert subscriptions
*
* @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()
{
$perCycle = 500;
$did = 0;
$limit = intval( \IPS\Request::i()->extra );
if( \IPS\Db::i()->checkForTable( 'gallery_favorites' ) )
{
foreach( \IPS\Db::i()->select( '*', 'gallery_favorites', NULL, 'id ASC', array( $limit, $perCycle ) ) as $favorite )
{
$did++;
\IPS\Db::i()->insert( 'core_follow', array(
'follow_app' => 'gallery',
'follow_area' => 'images',
'follow_rel_id' => $favorite['img_id'],
'follow_member_id' => $favorite['member_id'],
'follow_is_anon' => 0,
'follow_added' => time(),
'follow_notify_do' => 0,
'follow_notify_freq' => 'immediate',
'follow_visible' => 1,
) );
}
}
if( $did )
{
return ( $limit + $did );
}
else
{
return TRUE;
}
}
}