Diagnose and resolve Moodle plugin issues with GitHub issue tracking integration
Diagnoses Moodle plugin issues and integrates with GitHub for tracking and resolution.
/plugin marketplace add astoeffer/plugin-marketplace/plugin install moodle-dev-pro@astoeffer-dev-plugins/sc:troubleshoot [issue] [--type error|test|db|oauth|perf] [--create-issue] [--search-issues]
Key behaviors:
# Search for similar issues
gh issue list --repo astoeffer/Moodle-Nextcloud-Folder-Plugin --search "nextcloud connection"
gh issue view <number> --comments # View detailed discussion
# Create issue with diagnostic data
gh issue create --repo astoeffer/Moodle-Nextcloud-Folder-Plugin \
--title "Error: Could not connect to Nextcloud" \
--label "bug,oauth2" \
--body "$(cat issue_template.md)"
"Could not connect to Nextcloud. Please check your internet connection and try again."
Diagnosis Steps:
"Moodle PHPUnit environment was initialised for different version"
Resolution:
"Plugin version in database doesn't match version.php"
Resolution:
/sc:troubleshoot "Could not connect to Nextcloud" --search-issues
# 1. Search GitHub for similar issues
# 2. Check error logs and debug output
# 3. Test connectivity with curl
# 4. Verify OAuth2 configuration
# 5. Create/update GitHub issue with findings
/sc:troubleshoot "PHPUnit test failures" --type test
# 1. Check test environment initialization
# 2. Verify database prefix configuration
# 3. Examine specific test errors
# 4. Check for missing mock objects
# 5. Document in GitHub issue
/sc:troubleshoot "Slow folder browsing" --type perf --create-issue
# 1. Enable Moodle performance debugging
# 2. Check database query times
# 3. Analyze WebDAV response times
# 4. Profile PHP execution
# 5. Create issue with metrics
// In config.php
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;
$CFG->debugsmtp = true;
$CFG->perfdebug = 15;
$CFG->debugpageinfo = 1;
# Moodle error log
tail -f /workspace/moodledata/error.log
# PHP error log
tail -f /var/log/php_errors.log
# Apache/Nginx logs
tail -f /var/log/apache2/error.log
-- Check plugin version
SELECT * FROM mdl_config_plugins WHERE plugin = 'nextcloudfolder';
-- Check OAuth2 issuers
SELECT * FROM mdl_oauth2_issuer;
-- Check recent errors
SELECT * FROM mdl_logstore_standard_log
WHERE timecreated > UNIX_TIMESTAMP(NOW() - INTERVAL 1 HOUR)
AND component = 'mod_nextcloudfolder';
When creating GitHub issues, use this template:
## Environment
- Moodle Version: 4.5.6
- Plugin Version: 2.0.0
- PHP Version: 8.1
- Database: MariaDB 10.6
- Container: Yes/No
## Issue Description
[Clear description of the problem]
## Error Message
[Exact error message]
## Steps to Reproduce
1. [Step 1]
2. [Step 2]
3. [Step 3]
## Diagnostic Information
### Error Logs
[Relevant log entries]
### Debug Output
[Debug information]
### Network Tests
[curl/ping results if connectivity issue]
## Expected Behavior
[What should happen]
## Actual Behavior
[What actually happens]
## Attempted Solutions
- [ ] Solution 1
- [ ] Solution 2
## Additional Context
[Any other relevant information]
/sc:troubleshoot "Could not connect to Nextcloud" --search-issues --create-issue
# Searches existing issues for "nextcloud connection"
# Runs connectivity tests
# Creates detailed GitHub issue with diagnostics
/sc:troubleshoot "PHPUnit initialization failed" --type test
# Checks database tables and data directories
# Verifies config.php settings
# Documents solution in existing or new issue
/sc:troubleshoot "Upgrade blocked by version mismatch" --type db --create-issue
# Checks version in database vs version.php
# Provides SQL fix commands
# Creates issue for tracking
Will:
Will Not: