Skip to content

306 remove profilefields #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: MOODLE_401_STABLE
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 11 additions & 108 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,15 @@
name: Moodle Plugin CI
# .github/workflows/ci.yml
name: ci

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
mariadb:
# https://tracker.moodle.org/browse/MDL-72131
image: mariadb:10.5
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
moodle-branch: ['MOODLE_401_STABLE']
database: ['pgsql', 'mariadb']
extensions: ["mbstring, pgsql, mysqli"]
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations

steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
path: plugin

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
tools: phpunit
coverage: none

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV

- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: PHP Lint
if: ${{ always() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ false }}
run: moodle-plugin-ci codechecker --max-warnings 0

- name: Moodle PHPDoc Checker
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ false }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
run: moodle-plugin-ci phpunit

- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome
ci:
uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main
# Required if you plan to publish (uncomment the below)
# secrets:
# moodle_org_token: ${{ secrets.MOODLE_ORG_TOKEN }}
with:
disable_phpcs: true
disable_phpdoc: true
disable_grunt: true
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Release notes
=============

2025040300
1. 2025-04-03 User profile fields created in recent versions of this plugin are no longer used, however, will not be deleted automatically. The data is now pulled directly from the log in the database, and displayed via a profile hook on a users profile page.

2025020503

1. 2025-02-05 - fix: URL on old and new user profile fields definition.
Expand Down
103 changes: 0 additions & 103 deletions classes/local/observer/update_user_profiles_on_merging_success.php

This file was deleted.

45 changes: 0 additions & 45 deletions classes/local/profile_fields.php

This file was deleted.

8 changes: 7 additions & 1 deletion classes/tool_mergeusers_logger.php → classes/logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_mergeusers;

use Exception;
use moodle_url;
use stdClass;

require_once __DIR__ . '/../../../../config.php';

global $CFG;
Expand All @@ -32,7 +38,7 @@
* Class to manage logging actions for this tool.
* General log table cannot be used for log.info field length restrictions.
*/
class tool_mergeusers_logger {
class logger {

/**
* Adds a merging action log into tool log.
Expand Down
43 changes: 35 additions & 8 deletions db/access.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
<?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/>.

$capabilities = array(
'tool/mergeusers:mergeusers' => array(
/**
* Plugin capabilities.
*
* @package tool
* @subpackage mergeusers
* @author Ray Morris
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$capabilities = [
'tool/mergeusers:mergeusers' => [
'riskbitmask' => RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'archetypes' => [
'manager' => CAP_ALLOW,
),
],
'clonepermissionsfrom' => 'moodle/user:delete'
),
);


],
'tool/mergeusers:viewlog' => [
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'manager' => CAP_ALLOW,
],
],
];
5 changes: 0 additions & 5 deletions db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,4 @@
'callback' => '\tool_mergeusers\local\observer\keptuser::make_kept_user_as_not_suspended',
'internal' => 1
),
array(
'eventname' => 'tool_mergeusers\event\user_merged_success',
'callback' => tool_mergeusers\local\observer\update_user_profiles_on_merging_success::class . '::update',
'internal' => 1
)
);
Loading
Loading