GC_Debug_Data::get_database_size()

最后更新于:2021-11-27 13:59:12

GC_Debug_Data::get_database_size()

Fetch the total size of all the database tables for the active database user.

响应

(int) The size of the database, in bytes.

源文件

文件: gc-admin/includes/class-gc-debug-data.php

	public static function get_database_size() {
		global $gcdb;
		$size = 0;
		$rows = $gcdb->get_results( 'SHOW TABLE STATUS', ARRAY_A );

		if ( $gcdb->num_rows > 0 ) {
			foreach ( $rows as $row ) {
				$size += $row['Data_length'] + $row['Index_length'];
			}
		}

		return (int) $size;
	}