Version 5.0.0 beta 8

This commit is contained in:
Neo committed 2025-12-19 17:30:12 -08:00
1 parent 54d5dcd0a0
commit 214f649f1d
483 files changed
+35354 -33568

No files matched your search

@@ -14,6 +14,7 @@ namespace IPS\core\extensions\core\CommunityEnhancements;
/* To prevent PHP errors (extending class does not exist) revealing path */
use DomainException;
use InvalidArgumentException;
use IPS\Extensions\CommunityEnhancementsAbstract;
use IPS\Helpers\Form;
use IPS\Helpers\Form\Codemirror;
@@ -75,20 +76,19 @@ class GoogleAnalytics extends CommunityEnhancementsAbstract
*/
public function edit() : void
{
$validation = function( $val ) {
if ( $val and !Request::i()->ga_code )
{
throw new DomainException('ga_code_required');
}
};
$form = new Form;
$form->add( new YesNo( 'ga_enabled', Settings::i()->ga_enabled, FALSE, array(), $validation ) );
$form->add( new Codemirror( 'ga_code', Settings::i()->ga_code, FALSE, array( 'height' => 150, 'codeModeAllowedLanguages' => [ 'xml' ] ), NULL, NULL, NULL, 'ga_code' ) );
$form->add( new YesNo( 'ga_enabled', Settings::i()->ga_enabled, FALSE, array(
'togglesOn' => [ 'ga_code' ]
) ) );
$form->add( new Codemirror( 'ga_code', Settings::i()->ga_code, null, array( 'height' => 150, 'codeModeAllowedLanguages' => [ 'xml' ] ), function( $val ){
if( empty( $val ) and Request::i()->ga_enabled_checkbox )
{
throw new InvalidArgumentException('form_required');
}
}, NULL, NULL, 'ga_code' ) );
if ( $form->values() )
if( $form->values() )
{
try
{
@@ -15,9 +15,11 @@ namespace IPS\core\extensions\core\Queue;
use Exception;
use IPS\Application;
use IPS\Data\Store;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Log;
use IPS\Member;
use IPS\Patterns\ActiveRecord;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Text\Parser;
use OutOfRangeException;
@@ -25,6 +27,7 @@ use Throwable;
use function defined;
use function is_array;
use const IPS\REBUILD_NORMAL;
use const IPS\UPGRADE_LARGE_TABLE_SIZE;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -54,18 +57,11 @@ class RebuildLazyLoad extends QueueAbstract
Log::debug( "Getting preQueueData for " . $classname, 'rebuildLazyLoad' );
try
{
$data['count'] = $classname::db()->select( 'MAX(' . $classname::$databasePrefix . $classname::$databaseColumnId . ')', $classname::$databaseTable, ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? $classname::commentWhere() : array() )->first();
$data['realCount'] = $classname::db()->select( 'COUNT(*)', $classname::$databaseTable, ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? $classname::commentWhere() : array() )->first();
/* Set the count and realCount */
$data = array_merge( $data, $this->getCountDataFromClass( $classname ) );
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
$data['runPid'] = $data['count'] + 1;
}
catch( Exception $ex )
{
throw new OutOfRangeException;
}
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
$data['runPid'] = $data['count'] + 1;
Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildLazyLoad' );
@@ -193,6 +189,6 @@ class RebuildLazyLoad extends QueueAbstract
throw new OutOfRangeException;
}
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_lazyload_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl_lc' ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_lazyload_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl_lc' ) ) ) ), 'complete' => ( $data['realCount'] and $data['realCount'] < UPGRADE_LARGE_TABLE_SIZE ) ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : null );
}
}
@@ -27,6 +27,7 @@ use function defined;
use function get_class;
use function is_array;
use const IPS\REBUILD_SLOW;
use const IPS\UPGRADE_LARGE_TABLE_SIZE;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -56,18 +57,11 @@ class RebuildPosts extends QueueAbstract
Log::debug( "Getting preQueueData for " . $classname, 'rebuildPosts' );
try
{
$data['count'] = $classname::db()->select( 'MAX(' . $classname::$databasePrefix . $classname::$databaseColumnId . ')', $classname::$databaseTable, ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? $classname::commentWhere() : array() )->first();
$data['realCount'] = $classname::db()->select( 'COUNT(*)', $classname::$databaseTable, ( is_subclass_of( $classname, 'IPS\Content\Comment' ) ) ? $classname::commentWhere() : array() )->first();
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
$data['runPid'] = $data['count'] + 1;
}
catch( Exception $ex )
{
throw new OutOfRangeException;
}
/* Set the count and realCount */
$data = array_merge( $data, $this->getCountDataFromClass( $classname ) );
/* We're going to use the < operator, so we need to ensure the most recent item is rebuilt */
$data['runPid'] = $data['count'] + 1;
Log::debug( "PreQueue count for " . $classname . " is " . $data['count'], 'rebuildPosts' );
@@ -234,6 +228,6 @@ class RebuildPosts extends QueueAbstract
throw new OutOfRangeException;
}
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl_lc' ) ) ) ), 'complete' => $data['realCount'] ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : 100 );
return array( 'text' => Member::loggedIn()->language()->addToStack('rebuilding_stuff', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $class::$title . '_pl_lc' ) ) ) ), 'complete' => ( $data['realCount'] and $data['realCount'] < UPGRADE_LARGE_TABLE_SIZE ) ? ( round( 100 / $data['realCount'] * $data['indexed'], 2 ) ) : null );
}
}