Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,16 +12,24 @@
|
||||
namespace IPS\forums\setup\upg_105116;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\forums\Topic;
|
||||
use IPS\Settings;
|
||||
use function defined;
|
||||
use function IPS\Cicloud\getForcedArchiving;
|
||||
use const IPS\CIC2;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.5.4 Upgrade Code
|
||||
*/
|
||||
class _Upgrade
|
||||
class Upgrade
|
||||
{
|
||||
/**
|
||||
* Tweak archiving for CIC2
|
||||
@@ -31,23 +39,23 @@ class _Upgrade
|
||||
public function step1()
|
||||
{
|
||||
/* If this is a CIC2 site... */
|
||||
if ( \IPS\CIC2 )
|
||||
if ( CIC2 )
|
||||
{
|
||||
/* Make sure archiving is on if it should be */
|
||||
if( \IPS\Cicloud\getForcedArchiving() )
|
||||
if( getForcedArchiving() )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'archive' ) );
|
||||
Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'archive' ) );
|
||||
}
|
||||
/* Otherwise unarchive everything and make sure archiving is not enabled. They can turn back on later if they want. */
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->update( 'forums_topics', array( 'topic_archive_status' => \IPS\forums\Topic::ARCHIVE_RESTORE ), array( 'topic_archive_status=?', \IPS\forums\Topic::ARCHIVE_DONE ) );
|
||||
Db::i()->update( 'forums_topics', array( 'topic_archive_status' => Topic::ARCHIVE_RESTORE ), array( 'topic_archive_status=?', Topic::ARCHIVE_DONE ) );
|
||||
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 0 ), array( '`key`=?', 'archive' ) );
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'unarchive' ) );
|
||||
Db::i()->update( 'core_tasks', array( 'enabled' => 0 ), array( '`key`=?', 'archive' ) );
|
||||
Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'unarchive' ) );
|
||||
|
||||
/* This disables the archiving setting */
|
||||
\IPS\Settings::i()->changeValues( array( 'archive_last_post_cloud' => 100 ) );
|
||||
Settings::i()->changeValues( array( 'archive_last_post_cloud' => 100 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user