File tree Expand file tree Collapse file tree 6 files changed +3
-17
lines changed Expand file tree Collapse file tree 6 files changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -94,12 +94,7 @@ public function get_disk_usage() {
94
94
return get_string ('notcalculated ' , 'block_site_stats ' );
95
95
}
96
96
97
- $ unit = get_string ('sizemb ' , 'block_site_stats ' );
98
- if ($ diskusagecache > 1024 ) {
99
- $ unit = get_string ('sizegb ' , 'block_site_stats ' );
100
- }
101
-
102
- return $ diskusagecache . $ unit ;
97
+ return $ diskusagecache ;
103
98
}
104
99
/**
105
100
* Export the data for template
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public function execute() {
44
44
global $ CFG ;
45
45
$ cache = cache::make ('block_site_stats ' , 'sitestats ' );
46
46
$ diskusage = get_directory_size ($ CFG ->dataroot );
47
- $ disksize = number_format ( ceil ( $ diskusage / 1048576 ) );
47
+ $ disksize = display_size ( $ diskusage );
48
48
$ cache ->set ('diskusage ' , $ disksize );
49
49
return true ;
50
50
}
Original file line number Diff line number Diff line change 31
31
$ string ['privacy:metadata ' ] = 'The Site Statistics block only shows data stored in other locations. ' ;
32
32
$ string ['site_stats:myaddinstance ' ] = 'Add a new Site Statistics block to Dashboard ' ;
33
33
$ string ['site_stats:view ' ] = 'View Site Statistics block content ' ;
34
- $ string ['sizegb ' ] = ' GB ' ;
35
- $ string ['sizemb ' ] = ' MB ' ;
36
34
$ string ['users ' ] = 'Users ' ;
Original file line number Diff line number Diff line change 31
31
$ string ['privacy:metadata ' ] = 'साइट आँकड़े ब्लॉक केवल अन्य स्थानों में संग्रहित डेटा दिखाता है। ' ;
32
32
$ string ['site_stats:myaddinstance ' ] = 'डैशबोर्ड पर नया साइट आँकड़ा ब्लॉक जोड़ें ' ;
33
33
$ string ['site_stats:view ' ] = 'साइट आँकड़े ब्लॉक की सामग्री देखें ' ;
34
- $ string ['sizegb ' ] = ' जीबी ' ;
35
- $ string ['sizemb ' ] = ' एमबी ' ;
36
34
$ string ['users ' ] = 'उपयोगकर्ता ' ;
Original file line number Diff line number Diff line change 31
31
$ string ['privacy:metadata ' ] = 'साइट सांख्यिकी ब्लॉक फक्त इतर स्थानांतील डेटा दर्शवितो. ' ;
32
32
$ string ['site_stats:myaddinstance ' ] = 'डॅशबोर्डवर नविन साइट सांख्यिकी ब्लॉक जोडा ' ;
33
33
$ string ['site_stats:view ' ] = 'साइट सांख्यिकी ब्लॉक सामग्री पहा ' ;
34
- $ string ['sizegb ' ] = ' जीबी ' ;
35
- $ string ['sizemb ' ] = ' एमबी ' ;
36
34
$ string ['users ' ] = 'वापरकर्ते ' ;
Original file line number Diff line number Diff line change @@ -95,20 +95,17 @@ public function test_get_activities_count(): void {
95
95
* @return void
96
96
*/
97
97
public function test_get_disk_usage (): void {
98
- global $ CFG ;
99
98
// Test when the diskusage scheduled task is not run.
100
99
$ diskusage = $ this ->main ->get_disk_usage ();
101
100
$ expected = get_string ('notcalculated ' , 'block_site_stats ' );
102
101
$ this ->assertEquals ($ expected , $ diskusage );
103
102
104
103
// Test when the diskusage scheduled task is run.
105
- $ diskusage = get_directory_size ($ CFG ->dataroot );
106
- $ disksize = number_format (ceil ($ diskusage / 1048576 ));
107
104
$ task = new diskusage ();
108
105
$ status = $ task ->execute ();
109
106
if ($ status ) {
110
107
$ diskusage = $ this ->main ->get_disk_usage ();
111
- $ this ->assertEquals ( $ disksize . ' MB ' , $ diskusage );
108
+ $ this ->assertNotEquals ( $ expected , $ diskusage );
112
109
}
113
110
}
114
111
}
You can’t perform that action at this time.
0 commit comments