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

+39 -24
View File
@@ -2915,30 +2915,8 @@ class Db extends mysqli
return FALSE;
}
/* Have we gathered the table data yet? */
if( !isset( $this->cachedTableData[ $tableName ] ) )
{
$this->cachedTableData[ $tableName ] = array( 'rows' => 0, 'size' => 0 );
if ( ! \IPS\CIC )
{
/* Outside of Cloud we don't know if it's InnoDB, etc */
$this->cachedTableData[ $tableName ]['rows'] = $this->select( 'count(*)', $tableName )->first();
}
$result = $this->forceQuery("SHOW TABLE STATUS WHERE name LIKE '" . $this->prefix . $tableName . "'");
while( $data = $result->fetch_assoc() )
{
$this->cachedTableData[ $tableName ]['size'] = $data['Data_length'];
if ( \IPS\CIC )
{
/* Less accurate but much faster */
$this->cachedTableData[ $tableName ]['rows'] = $data['Rows'];
}
}
}
/* Make sure we have the table information */
$this->getTableData( $tableName );
/* Now determine if we're over our limits and return appropriately */
if( $this->cachedTableData[ $tableName ]['rows'] > UPGRADE_MANUAL_THRESHOLD)
@@ -2954,6 +2932,43 @@ class Db extends mysqli
return FALSE;
}
/**
* Return the rows and size for the specified table.
* Used to get an approximate count for large tables.
*
* @param string $tableName
* @return array
*/
public function getTableData( string $tableName ) : array
{
/* Have we gathered the table data yet? */
if( !isset( $this->cachedTableData[ $tableName ] ) )
{
$this->cachedTableData[ $tableName ] = array( 'rows' => 0, 'size' => 0 );
if ( !CIC )
{
/* Outside of Cloud we don't know if it's InnoDB, etc */
$this->cachedTableData[ $tableName ]['rows'] = $this->select( 'count(*)', $tableName )->first();
}
$result = $this->forceQuery("SHOW TABLE STATUS WHERE name LIKE '" . $this->prefix . $tableName . "'");
while( $data = $result->fetch_assoc() )
{
$this->cachedTableData[ $tableName ]['size'] = $data['Data_length'];
if ( CIC )
{
/* Less accurate but much faster */
$this->cachedTableData[ $tableName ]['rows'] = $data['Rows'];
}
}
}
return $this->cachedTableData[ $tableName ];
}
/**
* Strip comments from a .sql file
*