检查站点是否已使用其分配的上载空间。
原型
upload_is_user_over_quota( bool $echo = true )
参数
$echo
(bool)
(Optional)
如果设置了$ echo并超出配额,则会回显警告消息。默认为true。
返回值
(bool)
如果用户超过上载空间配额,则为True,否则为false。
源文件
路径:wp-admin/includes/ms.php
<?php
...
function upload_is_user_over_quota( $echo = true ) {
if ( get_site_option( 'upload_space_check_disabled' ) )
return false;
$space_allowed = get_space_allowed();
if ( ! is_numeric( $space_allowed ) ) {
$space_allowed = 10; // Default space allowed is 10 MB
}
$space_used = get_space_used();
if ( ( $space_allowed - $space_used ) < 0 ) {
if ( $echo )
_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
return true;
} else {
return false;
}
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/upload_is_user_over_quota/