mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-77306 Site Registration: add extra statistics
Add the DB type, count of courses with start or end dates set, default site theme, and primary auth type statistics to those collected as part of the site registration data.
This commit is contained in:
parent
f7a8df253b
commit
4c76cc46f8
@ -37,10 +37,12 @@ $string['badgesnumber'] = 'Number of badges ({$a})';
|
||||
$string['communityremoved'] = 'That course link has been removed from your list';
|
||||
$string['confirmregistration'] = 'Confirm registration';
|
||||
$string['coursename'] = 'Name';
|
||||
$string['coursesnodates'] = 'Number of courses without start and end dates set ({$a})';
|
||||
$string['coursepublished'] = 'This course has been shared successfully on \'{$a}\'.';
|
||||
$string['courseshortname'] = 'Shortname';
|
||||
$string['courseshortname_help'] = 'Enter a short name for your course. It does not need to be unique.';
|
||||
$string['coursesnumber'] = 'Number of courses ({$a})';
|
||||
$string['dbtype'] = 'Database type ({$a})';
|
||||
$string['demourl'] = 'Demo URL';
|
||||
$string['demourl_help'] = 'Enter the demo URL of your course. By default it is the URL of your course. The demo URL is displayed as a link in a search result.';
|
||||
$string['downloadable'] = 'Downloadable';
|
||||
@ -93,6 +95,7 @@ $string['postaladdress'] = 'Postal address';
|
||||
$string['postaladdress_help'] = 'Postal address of this site, or of the entity represented by this site.';
|
||||
$string['postsnumber'] = 'Number of posts ({$a})';
|
||||
$string['previousregistrationdeleted'] = 'The previous registration has been deleted from {$a}. You can restart the registration process. Thank you.';
|
||||
$string['primaryauthtype'] = 'Primary authentication type ({$a})';
|
||||
$string['questionsnumber'] = 'Number of questions ({$a})';
|
||||
$string['registeredcourses'] = 'Registered courses';
|
||||
$string['registeredsites'] = 'Registered sites';
|
||||
@ -156,6 +159,7 @@ $string['siterelease'] = 'Moodle release';
|
||||
$string['sitereleasenum'] = 'Moodle release ({$a})';
|
||||
$string['siterelease_help'] = 'Moodle release number of this site.';
|
||||
$string['siteurl'] = 'Site URL';
|
||||
$string['sitetheme'] = 'Site theme ({$a})';
|
||||
$string['siteurl_help'] = 'The URL is the address of this site. If privacy settings allow people to see site addresses then this is the URL that will be used.';
|
||||
$string['siteversion'] = 'Moodle version';
|
||||
$string['siteversion_help'] = 'The Moodle version of this site.';
|
||||
|
@ -60,6 +60,8 @@ class registration {
|
||||
2019022200 => ['analyticsenabledmodels', 'analyticspredictions', 'analyticsactions', 'analyticsactionsnotuseful'],
|
||||
// Active users stats added in Moodle 3.9.
|
||||
2020022600 => ['activeusers', 'activeparticipantnumberaverage'],
|
||||
// Database type, course date info, site theme, primary auth type added in Moodle 4.2.
|
||||
2023021700 => ['dbtype', 'coursesnodates', 'sitetheme', 'primaryauthtype'],
|
||||
];
|
||||
|
||||
/** @var Site privacy: not displayed */
|
||||
@ -180,6 +182,12 @@ class registration {
|
||||
$siteinfo['participantnumberaverage'] = average_number_of_participants();
|
||||
$siteinfo['activeparticipantnumberaverage'] = average_number_of_participants(true, time() - DAYSECS * 30);
|
||||
$siteinfo['modulenumberaverage'] = average_number_of_courses_modules();
|
||||
$siteinfo['dbtype'] = $CFG->dbtype;
|
||||
$siteinfo['coursesnodates'] = $DB->count_records_select('course', 'startdate = ? AND enddate = ?', [0, 0]) - 1;
|
||||
$siteinfo['sitetheme'] = get_config('core', 'theme');
|
||||
$siteinfo['primaryauthtype'] = $DB->get_field_sql(
|
||||
'SELECT auth, count(auth) as tc FROM {user} GROUP BY auth ORDER BY tc DESC LIMIT 1'
|
||||
);
|
||||
|
||||
// Version and url.
|
||||
$siteinfo['moodlerelease'] = $CFG->release;
|
||||
@ -254,6 +262,10 @@ class registration {
|
||||
'analyticspredictions' => get_string('analyticspredictions', 'hub', $siteinfo['analyticspredictions']),
|
||||
'analyticsactions' => get_string('analyticsactions', 'hub', $siteinfo['analyticsactions']),
|
||||
'analyticsactionsnotuseful' => get_string('analyticsactionsnotuseful', 'hub', $siteinfo['analyticsactionsnotuseful']),
|
||||
'dbtype' => get_string('dbtype', 'hub', $siteinfo['dbtype']),
|
||||
'coursesnodates' => get_string('coursesnodates', 'hub', $siteinfo['coursesnodates']),
|
||||
'sitetheme' => get_string('sitetheme', 'hub', $siteinfo['sitetheme']),
|
||||
'primaryauthtype' => get_string('primaryauthtype', 'hub', $siteinfo['primaryauthtype']),
|
||||
];
|
||||
|
||||
foreach ($senddata as $key => $str) {
|
||||
|
44
lib/tests/hub/registration_test.php
Normal file
44
lib/tests/hub/registration_test.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core\hub;
|
||||
|
||||
/**
|
||||
* Class containing unit tests for the site registration class.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2023 Matt Porritt <matt.porritt@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
*/
|
||||
class registration_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test getting site registration information.
|
||||
*
|
||||
* return void
|
||||
* @covers \core\hub\registration
|
||||
*/
|
||||
public function test_get_site_info(): void {
|
||||
global $CFG;
|
||||
|
||||
$siteinfo = registration::get_site_info();
|
||||
|
||||
$this->assertNull($siteinfo['policyagreed']);
|
||||
$this->assertEquals($CFG->dbtype, $siteinfo['dbtype']);
|
||||
$this->assertEquals('manual', $siteinfo['primaryauthtype']);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user