moodle-upgrade-migration

moodle-upgrade-migration is a cursor rule for Cursor from SaadRahman01/claude-moodle-dev. It costs 0 tokens per session (3,347 once invoked), scanned A, original, MIT.

A set of rules for updating Moodle plugins to newer Moodle and PHP versions. Moodle is a platform for online courses, and plugins are add-ons that extend it; the rules cover changed programming interfaces and required release notes.

In plain words
What is it for?
Use it when migrating a Moodle plugin, fixing deprecated programming interfaces, supporting PHP 8.1–8.4, preparing for Moodle 4.x or 5.x, or checking a plugin before submission.
Why use it?
It helps replace older Moodle code that now produces warnings, fails stricter PHP checks, or is rejected from the Moodle plugin directory. It also covers database upgrade steps and compatibility settings.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when migrating a Moodle plugin, fixing deprecated programming interfaces, supporting PHP 8.1–8.4, preparing for Moodle 4.x or 5.x, or checking a plugin before submission.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/saadrahman01/claude-moodle-dev/moodle-upgrade-migration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for moodle-upgrade-migration

README.md
[![agentmods](https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/moodle-upgrade-migration.svg)](https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/moodle-upgrade-migration)
Your own site
<a href="https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/moodle-upgrade-migration"><img src="https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/moodle-upgrade-migration.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,347 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.03347
Opus 5 $0.00000 $0.01673
Sonnet 5 $0.00000 $0.00669
Haiku 4.5 $0.00000 $0.00335

Measured 8d ago against content hash 74ce05425be8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

moodle-upgrade-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

adapters/cursor/.cursor/rules/moodle-upgrade-migration.mdc · 323 lines

How it starts

The opening of the file, as written. The whole thing — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Moodle Upgrade & Migration

Overview

Moodle deprecates aggressively but rarely removes. Code from Moodle 2.x often still runs in 4.5 — but uses APIs that emit warnings, fail PHP 8 strict checks, or block plugin directory acceptance. This skill catalogs the migration path from each generation.

When to Use

  • Upgrading a plugin to support a newer Moodle version
  • Resolving deprecation warnings
  • Migrating to PHP 8.1 / 8.2 / 8.3 / 8.4
  • Plugin directory submission rejection ("uses deprecated API")
  • Cross-version compat ($plugin->requires bump)

Strategy

  1. Bump $plugin->requires to your minimum target Moodle version
  2. Replace deprecated APIs (table below)
  3. Add upgrade.txt to document changes
  4. Run phpcs --standard=moodle + visual smoke test
  5. Bump $plugin->version + add db/upgrade.php step if schema changed

Deprecation table

Old New Since
print_error('errkey', 'comp') throw new \moodle_exception('errkey', 'comp') 3.7
add_to_log() Trigger an event class 2.7
notify('text', 'notifyproblem') \core\notification::error('text') 3.0
redirect($url, 'msg', 0) redirect($url, 'msg', null, \core\notification::INFO) 3.0
external_api (bare) \core_external\external_api 4.2
external_function_parameters etc. \core_external\... 4.2
$mform->setHelpButton() $mform->addHelpButton() 2.0
Magic callbacks <comp>_extend_navigation Hooks API \core\hook\... (where applicable) 4.4
\core\session\manager::write_close() Same — but check if needed
mtrace() in non-CLI Use debugging() or proper logger
cleardoubleslashes Use clean_param($url, PARAM_URL)
addslashes() for DB Use $DB->... placeholders 2.0
mysql_* functions $DB always 2.0
userdate($t, '', false) (no timezone) Pass timezone or use core_date::get_user_timezone_object() 3.2
create_function() Closures function() { } PHP 7.2 removed
each($array) foreach PHP 7.2 removed
assert($string) Real expression PHP 7.2+
(unset) cast Plain unset() PHP 7.2+
\Mustache_Engine direct $OUTPUT->render_from_template
cm_info::get_modinfo second arg API change in 3.4 3.4
format_text no context Always pass ['context' => $context] 2.0
\html_writer::nonempty_tag Use html_writer::tag with check 3.5
\stdClass w/o : \stdClass return type in PHP 8.1+ Add return types 8.1

Read the full file on GitHub · 323 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 323 lines · 0 tokens per session scan A 74ce05425be8

Subscribe to this mod's changes

moodle-upgrade-migration is a cursor rule published in the GitHub repository SaadRahman01/claude-moodle-dev (36 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,347 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.