6
development
Jonathan Miller edited this page 2026-05-16 18:31:27 +00:00

< Home | Architecture | Troubleshooting >

Development Guide

Local Setup

git clone https://git.mokoconsulting.tech/MokoConsulting/MokoGalleryCalendar.git
cd MokoGalleryCalendar

The installable plugin source lives in src/. Everything outside src/ (workflows, docs, README) is repo-level infrastructure.

Building a ZIP

cd src
zip -r ../mokojgdpc.zip . \
  -x ".ftpignore" "sftp-config*" "*.ppk" "*.pem" "*.key" ".env*"

Or trigger the release workflow via Gitea Actions (see CI/CD below).

Testing Locally

  1. Symlink or copy src/ into your Joomla installation:
    plugins/system/mokojgdpc/ -> src/
    
  2. Discover and enable the plugin via System > Manage > Extensions > Discover
  3. The install script will create the mapping table and seed existing events

Key Methods

MokoJGDPC.php

Method Visibility Purpose
onContentAfterSave() public Entry point for event creation/update
onContentAfterDelete() public Entry point for event deletion
onAfterRoute() public 7-day fallback for pending processing
processTask() private Task Scheduler entry point
processPendingMappings() private Core logic: find and create overdue categories
createGalleryCategory() private Nested set insert + access/rules
createCategoryAsset() private ACL asset record creation
deleteGalleryCategory() private Nested set delete + gap close
deleteCategoryAsset() private ACL asset cleanup
resolvePermissionRules() private Load rules from template category
uniqueAlias() private Deduplicate URL aliases
extractEventDate() private Parse event start date (site timezone)

script.php

Method Purpose
install() Create table, seed events, register scheduled task
update() Ensure table, migrate schema, ensure task
uninstall() Drop table, remove task, clean cache file
seedExistingEvents() Map all unmapped DPCalendar events on first install
migrateSchema() Add event_date column if upgrading from pre-01.00.01
ensureScheduledTask() Idempotent task registration in #__scheduler_tasks

Branching and Releases

Branch Purpose
main Stable releases
dev Development (PRs target here)

Releases are triggered via the release.yml workflow (workflow_dispatch). Dev releases use stability development; stable releases use stable.

CI/CD Workflows

release.yml

  • Triggered by tag push (XX.YY.ZZ) or manual dispatch

  • Auto-bumps patch version in README.md, manifest, and updates.xml

  • Builds ZIP from src/, creates Gitea release, uploads asset

  • Updates updates.xml with SHA-256 hash

  • Triggered on push to dev/alpha/beta/rc branches (when src/ changes)

  • Builds ZIP + tar.gz packages

  • Creates/updates Gitea releases per stability channel

  • Generates updates.xml entries for Joomla's update system

  • Optionally deploys to dev server via SFTP

Adding a New Config Field

  1. Add the <field> element to src/mokojgdpc.xml inside <fieldset name="basic">
  2. Add label and description language strings to both en-GB and en-US .ini files
  3. Read the value in PHP via $this->params->get('field_name', 'default')
  4. If the field affects seeding, also read it in script.php from $pluginParams

Modifying the Database Schema

  1. Update the CREATE TABLE statement in script.php::createTable()
  2. Add an ALTER TABLE in script.php::migrateSchema() for upgrades
  3. The migration checks $db->getTableColumns() -- only runs if the column doesn't exist yet

Repo: MokoGalleryCalendar . MokoStandards

Revision Date Author Description
1.1 2026-05-10 Moko Consulting Add nav links, clean formatting
1.0 2026-05-09 Moko Consulting Initial version