Skip to content

Commit

Permalink
Merge branch 'moodle:main' into solrrag
Browse files Browse the repository at this point in the history
  • Loading branch information
mhughes2k authored Mar 13, 2024
2 parents 596fd89 + 70f6111 commit c4abe25
Show file tree
Hide file tree
Showing 547 changed files with 11,687 additions and 6,316 deletions.
2 changes: 0 additions & 2 deletions admin/presets/tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ private function add_to_config_log(string $name, string $oldvalue, string $value
public function access_protected($object, string $property) {
$reflection = new ReflectionClass($object);
$property = $reflection->getProperty($property);
$property->setAccessible(true);
return $property->getValue($object);
}

Expand All @@ -244,7 +243,6 @@ public function get_admin_preset_setting(string $category, string $settingname):

// Set method accessibility.
$method = new ReflectionMethod(manager::class, 'get_setting');
$method->setAccessible(true);

// Get the proper adminpresets_setting instance.
$settingpage = $adminroot->locate($category);
Expand Down
12 changes: 12 additions & 0 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@
$temp->add($setting);
$ADMIN->add('authsettings', $temp);

// Toggle password visiblity icon.
$temp->add(new admin_setting_configselect('loginpasswordtoggle',
new lang_string('auth_loginpasswordtoggle', 'auth'),
new lang_string('auth_loginpasswordtoggle_desc', 'auth'),
TOGGLE_SENSITIVE_SMALL_SCREENS_ONLY,
[
TOGGLE_SENSITIVE_DISABLED => get_string('disabled', 'admin'),
TOGGLE_SENSITIVE_ENABLED => get_string('enabled', 'admin'),
TOGGLE_SENSITIVE_SMALL_SCREENS_ONLY => get_string('smallscreensonly', 'admin'),
],
));

$temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true);
$ADMIN->add('authsettings', $temp);

Expand Down
2 changes: 0 additions & 2 deletions admin/tool/dataprivacy/tests/expired_contexts_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,6 @@ public function test_progress_tracer_default() {
$rc = new \ReflectionClass(\tool_dataprivacy\expired_contexts_manager::class);
$rcm = $rc->getMethod('get_progress');

$rcm->setAccessible(true);
$this->assertInstanceOf(\text_progress_trace::class, $rcm->invoke($manager));
}

Expand All @@ -2094,7 +2093,6 @@ public function test_progress_tracer_set() {
$rc = new \ReflectionClass(\tool_dataprivacy\expired_contexts_manager::class);
$rcm = $rc->getMethod('get_progress');

$rcm->setAccessible(true);
$this->assertSame($mytrace, $rcm->invoke($manager));
}

Expand Down
1 change: 0 additions & 1 deletion admin/tool/dataprivacy/tests/filtered_userlist_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function test_apply_expired_contexts_filters(array $initial, array $expir

$rc = new \ReflectionClass(\tool_dataprivacy\filtered_userlist::class);
$rcm = $rc->getMethod('set_userids');
$rcm->setAccessible(true);
$rcm->invoke($userlist, $initial);


Expand Down
1 change: 0 additions & 1 deletion admin/tool/langimport/tests/locale_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public function test_set_locale(string $set, string $ret) {
$loc = new locale();
$rc = new \ReflectionClass(locale::class);
$rm = $rc->getMethod('set_locale');
$rm->setAccessible(true);

// Capture current locale for later restore (funnily, using the set_locale() method itself.
$originallocale = $rm->invokeArgs($loc, [LC_ALL, 0]);
Expand Down
5 changes: 0 additions & 5 deletions admin/tool/licensemanager/tests/manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function test_edit_existing_license() {

// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_UPDATE, $testlicense->shortname);

// Should not create a new license when updating an existing license.
Expand All @@ -90,7 +89,6 @@ public function test_edit_license_not_exists() {

// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.

// Attempt to update a license that doesn't exist.
$formdata = [
Expand All @@ -111,7 +109,6 @@ public function test_edit_license_no_shortname() {

// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.

// Attempt to update a license without passing license shortname.
$formdata = [
Expand Down Expand Up @@ -148,7 +145,6 @@ public function test_edit_create_license() {

// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_CREATE, $formdata['shortname']);

// Should create a new license in database.
Expand Down Expand Up @@ -180,7 +176,6 @@ public function test_change_license_order() {

// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'change_license_order');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_MOVE_UP, 'cc-nc-4.0');

$licenseorder = array_keys(license_manager::get_licenses());
Expand Down
2 changes: 0 additions & 2 deletions admin/tool/mfa/factor/email/tests/factor_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function test_check_verification_code() {
$emailfactorclass = new \factor_email\factor('email');
$rc = new \ReflectionClass($emailfactorclass::class);
$rcm = $rc->getMethod('check_verification_code');
$rcm->setAccessible(true);

// Assigned email to be used in getting the email factor.
$USER->email = '[email protected]';
Expand Down Expand Up @@ -76,7 +75,6 @@ public function test_check_verification_code() {

// Cleans up email records once MFA passed.
$rcm = $rc->getMethod('post_pass_state');
$rcm->setAccessible(true);
$rcm->invoke($emailfactorclass);

// Check if the email records have been deleted.
Expand Down
1 change: 0 additions & 1 deletion admin/tool/mfa/factor/sms/tests/factor_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public function test_check_verification_code(): void {

// Check verification code.
$rcm = $rc->getMethod('check_verification_code');
$rcm->setAccessible(true);
$this->assertTrue($rcm->invoke($smsfactor, $secretcode));

// Test that calling the revoke on the generic type revokes all.
Expand Down
5 changes: 0 additions & 5 deletions admin/tool/mfa/factor/token/tests/factor_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function test_calculate_expiry_time_in_general() {

set_config('expireovernight', 0, 'factor_token');
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);

// Test that non-overnight timestamps are just exactly as configured.
// We don't need to care about 0 or negative ints, they will just make the cookie expire immediately.
Expand Down Expand Up @@ -95,7 +94,6 @@ public function test_calculate_expiry_time_in_general() {
public function test_calculate_expiry_time_for_overnight_expiry_with_one_day_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', DAYSECS, 'factor_token');

Expand Down Expand Up @@ -144,7 +142,6 @@ public function test_calculate_expiry_time_for_overnight_expiry_with_one_day_exp
public function test_calculate_expiry_time_for_overnight_expiry_with_two_day_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', 2 * DAYSECS, 'factor_token');

Expand Down Expand Up @@ -195,7 +192,6 @@ public function test_calculate_expiry_time_for_overnight_expiry_with_two_day_exp
public function test_calculate_expiry_time_for_overnight_expiry_with_three_hour_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', 3 * HOURSECS, 'factor_token');

Expand Down Expand Up @@ -240,7 +236,6 @@ public function test_calculate_expiry_time_for_overnight_expiry_with_three_hour_
public function test_calculate_expiry_time_for_overnight_expiry_with_an_hour_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', HOURSECS, 'factor_token');

Expand Down
5 changes: 0 additions & 5 deletions admin/tool/mfa/tests/secret_manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function test_create_secret() {

// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');

$sec1 = $secman->create_secret(1800, false);
Expand Down Expand Up @@ -97,7 +96,6 @@ public function test_add_secret_to_db() {
// Let's make stuff public using reflection.
$reflectedscanner = new \ReflectionClass($secman);
$reflectedmethod = $reflectedscanner->getMethod('add_secret_to_db');
$reflectedmethod->setAccessible(true);

// Now add a secret and confirm it creates the correct record.
$reflectedmethod->invoke($secman, 'code', 1800);
Expand Down Expand Up @@ -164,7 +162,6 @@ public function test_validate_secret() {
// Session locked code from the same session id.
// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');

$secret = $secman->create_secret(1800, true);
Expand Down Expand Up @@ -227,7 +224,6 @@ public function test_has_active_secret() {
$reflectedscanner = new \ReflectionClass($secman);

$reflectedmethod = $reflectedscanner->getMethod('has_active_secret');
$reflectedmethod->setAccessible(true);

// DB secrets.
$this->assertFalse($reflectedmethod->invoke($secman));
Expand All @@ -244,7 +240,6 @@ public function test_has_active_secret() {
// Now check a secret with session involvement.
// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');

$this->assertFalse($reflectedmethod->invoke($secman, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace tool_mobile\local\hooks\output;
namespace tool_mobile\local\hook\output;

/**
* Allows plugins to add any elements to the page <head> html tag
Expand All @@ -23,14 +23,13 @@
* @copyright 2023 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class standard_head_html_prepend {

class before_standard_head_html_generation {
/**
* Callback to add head elements.
*
* @param \core\hook\output\standard_head_html_prepend $hook
* @param \core\hook\output\before_standard_head_html_generation $hook
*/
public static function callback(\core\hook\output\standard_head_html_prepend $hook): void {
public static function callback(\core\hook\output\before_standard_head_html_generation $hook): void {
global $CFG, $PAGE;
// Smart App Banners meta tag is only displayed if mobile services are enabled and configured.
if (!empty($CFG->enablemobilewebservice)) {
Expand All @@ -45,7 +44,7 @@ public static function callback(\core\hook\output\standard_head_html_prepend $ho

if (!empty($mobilesettings->androidappid)) {
$mobilemanifesturl = "$CFG->wwwroot/$CFG->admin/tool/mobile/mobile.webmanifest.php";
$hook->add_html('<link rel="manifest" href="'.$mobilemanifesturl.'" />');
$hook->add_html('<link rel="manifest" href="' . $mobilemanifesturl . '" />');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/mobile/db/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

$callbacks = [
[
'hook' => core\hook\output\standard_head_html_prepend::class,
'callback' => 'tool_mobile\local\hooks\output\standard_head_html_prepend::callback',
'hook' => core\hook\output\before_standard_head_html_generation::class,
'callback' => 'tool_mobile\local\hook\output\before_standard_head_html_generation::callback',
'priority' => 0,
],
];
2 changes: 1 addition & 1 deletion admin/tool/mobile/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

defined('MOODLE_INTERNAL') || die();
$plugin->version = 2023100900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024022600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2023100400; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = [
Expand Down
13 changes: 2 additions & 11 deletions admin/tool/usertours/classes/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Cache manager.
*
* @package tool_usertours
* @copyright 2016 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_usertours;

defined('MOODLE_INTERNAL') || die();

/**
* Cache manager.
*
* @package tool_usertours
* @copyright 2016 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down Expand Up @@ -97,7 +88,7 @@ public static function get_matching_tourdata(\moodle_url $targetmatch) {
}

$target = $targetmatch->out_as_local_url();
return array_filter($tours, function($tour) use ($possiblematches, $target) {
return array_filter($tours, function ($tour) use ($possiblematches, $target) {
if (in_array($tour->pathmatch, $possiblematches)) {
return true;
}
Expand Down
27 changes: 8 additions & 19 deletions admin/tool/usertours/classes/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Step configuration detail class.
*
* @package tool_usertours
* @copyright 2016 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_usertours;

defined('MOODLE_INTERNAL') || die();

/**
* Step configuration detail class.
*
* @copyright 2016 Andrew Nicols <[email protected]>
* @package tool_usertours
* @copyright 2024 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class configuration {

/**
* @var TOURDEFAULT
*/
Expand All @@ -60,7 +50,7 @@ public static function get_defaultable_keys() {
* @return mixed
*/
public static function get_default_value($key) {
switch($key) {
switch ($key) {
case 'placement':
return 'bottom';
case 'orphan':
Expand All @@ -77,7 +67,7 @@ public static function get_default_value($key) {
* @return mixed
*/
public static function get_step_default_value($key) {
switch($key) {
switch ($key) {
case 'placement':
case 'orphan':
case 'backdrop':
Expand All @@ -94,10 +84,10 @@ public static function get_step_default_value($key) {
*/
public static function get_placement_options($default = null) {
$values = [
'top' => get_string('above', 'tool_usertours'),
'bottom' => get_string('below', 'tool_usertours'),
'left' => get_string('left', 'tool_usertours'),
'right' => get_string('right', 'tool_usertours'),
'top' => get_string('above', 'tool_usertours'),
'bottom' => get_string('below', 'tool_usertours'),
'left' => get_string('left', 'tool_usertours'),
'right' => get_string('right', 'tool_usertours'),
];

if ($default === null) {
Expand All @@ -114,5 +104,4 @@ public static function get_placement_options($default = null) {

return $values;
}

}
11 changes: 0 additions & 11 deletions admin/tool/usertours/classes/event/step_shown.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* The tool_usertours step_shown event.
*
* @package tool_usertours
* @copyright 2016 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_usertours\event;

defined('MOODLE_INTERNAL') || die();

/**
* The tool_usertours step_shown event.
*
Expand All @@ -41,7 +31,6 @@
* }
*/
class step_shown extends \core\event\base {

/**
* Init method.
*/
Expand Down
Loading

0 comments on commit c4abe25

Please sign in to comment.