Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b87a9c900 | |||
| a9ef62c9bd | |||
| 21e892013b |
@@ -5,7 +5,7 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Automation
|
# INGROUP: moko-platform.Automation
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.01
|
||||||
# BRIEF: Auto-create feature branch when an issue is opened
|
# BRIEF: Auto-create feature branch when an issue is opened
|
||||||
|
|
||||||
name: "Universal: Issue Branch"
|
name: "Universal: Issue Branch"
|
||||||
|
|||||||
@@ -8,4 +8,245 @@
|
|||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
||||||
# PATH: /templates/workflows/universal/pre-release.yml.template
|
# PATH: /templates/workflows/universal/pre-release.yml.template
|
||||||
# VERSION: 05.01.00
|
# VERSION: 05.01.00
|
||||||
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
|
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
|
||||||
|
|
||||||
|
name: "Universal: Pre-Release"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
- 'fix/**'
|
||||||
|
- 'patch/**'
|
||||||
|
- 'hotfix/**'
|
||||||
|
- 'bugfix/**'
|
||||||
|
- 'chore/**'
|
||||||
|
- alpha
|
||||||
|
- beta
|
||||||
|
- rc
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
stability:
|
||||||
|
description: 'Pre-release channel'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- development
|
||||||
|
- alpha
|
||||||
|
- beta
|
||||||
|
- release-candidate
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
||||||
|
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: "Build Pre-Release (${{ inputs.stability || github.ref_name }})"
|
||||||
|
runs-on: release
|
||||||
|
if: >-
|
||||||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
github.event_name == 'push'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: Setup moko-platform tools
|
||||||
|
env:
|
||||||
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
|
run: |
|
||||||
|
# Use pre-installed /opt/moko-platform if available (updated by cron every 6h)
|
||||||
|
if [ -f /opt/moko-platform/cli/version_bump.php ] && [ -f /opt/moko-platform/cli/manifest_element.php ] && [ -f /opt/moko-platform/vendor/autoload.php ]; then
|
||||||
|
echo Using pre-installed /opt/moko-platform
|
||||||
|
echo MOKO_CLI=/opt/moko-platform/cli >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo Falling back to fresh clone
|
||||||
|
if ! command -v composer > /dev/null 2>&1; then
|
||||||
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
rm -rf /tmp/moko-platform-api
|
||||||
|
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/moko-platform.git
|
||||||
|
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/moko-platform-api
|
||||||
|
cd /tmp/moko-platform-api && composer install --no-dev --no-interaction --quiet
|
||||||
|
echo MOKO_CLI=/tmp/moko-platform-api/cli >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Detect platform
|
||||||
|
id: platform
|
||||||
|
run: |
|
||||||
|
# Auto-detect and update platform if not set in manifest
|
||||||
|
php ${MOKO_CLI}/platform_detect.php --path . --github-output 2>/dev/null || true
|
||||||
|
php ${MOKO_CLI}/manifest_read.php --path . --github-output
|
||||||
|
|
||||||
|
- name: Resolve metadata and bump version
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
# Auto-detect stability from branch name on push, or use input on dispatch
|
||||||
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
case "${{ github.ref_name }}" in
|
||||||
|
rc) STABILITY="release-candidate" ;;
|
||||||
|
alpha) STABILITY="alpha" ;;
|
||||||
|
beta) STABILITY="beta" ;;
|
||||||
|
*) STABILITY="development" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
STABILITY="${{ inputs.stability || 'development' }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$STABILITY" in
|
||||||
|
development) SUFFIX="-dev"; TAG="development" ;;
|
||||||
|
alpha) SUFFIX="-alpha"; TAG="alpha" ;;
|
||||||
|
beta) SUFFIX="-beta"; TAG="beta" ;;
|
||||||
|
release-candidate) SUFFIX="-rc"; TAG="release-candidate" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Bump version via CLI: patch for dev/alpha/beta, minor for RC
|
||||||
|
case "$STABILITY" in
|
||||||
|
release-candidate) BUMP="minor" ;;
|
||||||
|
*) BUMP="patch" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
php ${MOKO_CLI}/version_bump.php --path . $([ "$BUMP" = "minor" ] && echo "--minor") 2>/dev/null || true
|
||||||
|
|
||||||
|
# Set stability suffix and verify consistency
|
||||||
|
VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null || echo "00.00.01")
|
||||||
|
VERSION=$(echo "$VERSION" | sed 's/-\(dev\|alpha\|beta\|rc\)$//')
|
||||||
|
|
||||||
|
php ${MOKO_CLI}/version_set_platform.php \
|
||||||
|
--path . --version "$VERSION" --branch "${{ github.ref_name }}" --stability "$STABILITY" 2>/dev/null || true
|
||||||
|
php ${MOKO_CLI}/version_check.php --path . --fix 2>/dev/null || true
|
||||||
|
|
||||||
|
# Ensure licensing tags (updateservers, dlid) if enabled in manifest.xml
|
||||||
|
php ${MOKO_CLI}/manifest_licensing.php --path . --fix 2>/dev/null || true
|
||||||
|
|
||||||
|
# Append suffix for output
|
||||||
|
if [ -n "$SUFFIX" ]; then
|
||||||
|
VERSION="${VERSION}${SUFFIX}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Commit version bump
|
||||||
|
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
|
git config --local user.name "gitea-actions[bot]"
|
||||||
|
git remote set-url origin "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
|
||||||
|
git add -A
|
||||||
|
git diff --cached --quiet || {
|
||||||
|
git commit -m "chore(version): pre-release bump to ${VERSION} [skip ci]"
|
||||||
|
git push origin HEAD 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Auto-detect element via manifest_element.php
|
||||||
|
php ${MOKO_CLI}/manifest_element.php \
|
||||||
|
--path . --version "$VERSION" --stability "$STABILITY" \
|
||||||
|
--repo "${GITEA_REPO}" --github-output
|
||||||
|
|
||||||
|
# Read back element outputs
|
||||||
|
EXT_ELEMENT=$(grep '^ext_element=' "$GITHUB_OUTPUT" | tail -1 | cut -d= -f2)
|
||||||
|
ZIP_NAME=$(grep '^zip_name=' "$GITHUB_OUTPUT" | tail -1 | cut -d= -f2)
|
||||||
|
[ -z "$EXT_ELEMENT" ] && EXT_ELEMENT=$(echo "${GITEA_REPO}" | tr '[:upper:]' '[:lower:]' | tr -d ' -')
|
||||||
|
[ -z "$ZIP_NAME" ] && ZIP_NAME="${EXT_ELEMENT}-${VERSION}.zip"
|
||||||
|
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "stability=${STABILITY}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "suffix=${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "zip_name=${ZIP_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "ext_element=${EXT_ELEMENT}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
echo "=== Pre-Release: ${EXT_ELEMENT} ${VERSION}${SUFFIX} ==="
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
id: release
|
||||||
|
run: |
|
||||||
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
|
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
php ${MOKO_CLI}/release_create.php \
|
||||||
|
--path . --version "$VERSION" --tag "$TAG" \
|
||||||
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
||||||
|
--repo "${GITEA_REPO}" --branch "${{ github.ref_name }}" --prerelease
|
||||||
|
|
||||||
|
- name: Update release notes from CHANGELOG.md
|
||||||
|
run: |
|
||||||
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
|
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
|
||||||
|
# Extract [Unreleased] section from changelog (everything between [Unreleased] and next ## heading)
|
||||||
|
if [ -f "CHANGELOG.md" ]; then
|
||||||
|
NOTES=$(awk '/^## \[Unreleased\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
|
||||||
|
[ -z "$NOTES" ] && NOTES="Release ${VERSION}"
|
||||||
|
else
|
||||||
|
NOTES="Release ${VERSION}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update release body via API
|
||||||
|
RELEASE_ID=$(curl -sf -H "Authorization: token ${{ secrets.MOKOGITEA_TOKEN }}" \
|
||||||
|
"${API_BASE}/releases/tags/${TAG}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||||
|
|
||||||
|
if [ -n "$RELEASE_ID" ]; then
|
||||||
|
python3 -c "
|
||||||
|
import json, urllib.request
|
||||||
|
body = open('/dev/stdin').read()
|
||||||
|
payload = json.dumps({'body': body}).encode()
|
||||||
|
req = urllib.request.Request(
|
||||||
|
'${API_BASE}/releases/${RELEASE_ID}',
|
||||||
|
data=payload, method='PATCH',
|
||||||
|
headers={
|
||||||
|
'Authorization': 'token ${{ secrets.MOKOGITEA_TOKEN }}',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
})
|
||||||
|
urllib.request.urlopen(req)
|
||||||
|
" <<< "$NOTES"
|
||||||
|
echo "Release notes updated from CHANGELOG.md"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build package and upload
|
||||||
|
id: package
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
|
TAG="${{ steps.meta.outputs.tag }}"
|
||||||
|
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
php ${MOKO_CLI}/release_package.php \
|
||||||
|
--path . --version "$VERSION" --tag "$TAG" \
|
||||||
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
||||||
|
--repo "${GITEA_REPO}" --output /tmp || true
|
||||||
|
|
||||||
|
# updates.xml is generated dynamically by MokoGitea license server
|
||||||
|
# No need to build, commit, or sync updates.xml from workflows
|
||||||
|
|
||||||
|
- name: "Delete lesser pre-release channels (cascade)"
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
|
php ${MOKO_CLI}/release_cascade.php \
|
||||||
|
--stability "${{ steps.meta.outputs.stability }}" \
|
||||||
|
--token "${TOKEN}" \
|
||||||
|
--api-base "${API_BASE}"
|
||||||
|
|
||||||
|
- name: Summary
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
|
STABILITY="${{ steps.meta.outputs.stability }}"
|
||||||
|
ZIP_NAME="${{ steps.meta.outputs.zip_name }}"
|
||||||
|
SHA256="${{ steps.package.outputs.sha256_zip }}"
|
||||||
|
echo "## Pre-Release Complete" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Channel | ${STABILITY} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Package | \`${ZIP_NAME}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| SHA-256 | \`${SHA256:-n/a}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
DEFGROUP: MokoStandards-Template-Joomla-Plugin
|
DEFGROUP: MokoStandards-Template-Joomla-Plugin
|
||||||
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin/
|
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin/
|
||||||
VERSION: 01.01.00
|
VERSION: 01.00.01
|
||||||
PATH: ./CODE_OF_CONDUCT.md
|
PATH: ./CODE_OF_CONDUCT.md
|
||||||
BRIEF: Community expectations and enforcement guidelines
|
BRIEF: Community expectations and enforcement guidelines
|
||||||
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
DEFGROUP: mokoconsulting-tech.MokoStandards-Template-Joomla-Plugin
|
DEFGROUP: mokoconsulting-tech.MokoStandards-Template-Joomla-Plugin
|
||||||
INGROUP: MokoStandards.Governance
|
INGROUP: MokoStandards.Governance
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin
|
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Plugin
|
||||||
VERSION: 01.01.00
|
VERSION: 01.00.01
|
||||||
PATH: /GOVERNANCE.md
|
PATH: /GOVERNANCE.md
|
||||||
BRIEF: Project governance rules, roles, and decision process for MokoStandards-Template-Joomla-Plugin
|
BRIEF: Project governance rules, roles, and decision process for MokoStandards-Template-Joomla-Plugin
|
||||||
-->
|
-->
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ DEFGROUP: MokoStandards-Template-Joomla-Plugin
|
|||||||
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
INGROUP: MokoStandards-Template-Joomla-Plugin.Documentation
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-Template-Joomla-Plugin
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-Template-Joomla-Plugin
|
||||||
PATH: /SECURITY.md
|
PATH: /SECURITY.md
|
||||||
VERSION: 01.01.00
|
VERSION: 01.00.01
|
||||||
BRIEF: Security vulnerability reporting and handling policy
|
BRIEF: Security vulnerability reporting and handling policy
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
PKG_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
PKG_MOKOSUITEANALYTICS_DESCRIPTION="Analytics package — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
PKG_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
PKG_MOKOSUITEANALYTICS_DESCRIPTION="Analytics package — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
COM_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
COM_MOKOSUITEANALYTICS_DESCRIPTION="Analytics — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_DASHBOARD_TITLE="Analytics Dashboard"
|
||||||
|
COM_MOKOSUITEANALYTICS_DASHBOARD_DESC="Monitor site traffic, manage campaigns, review ad performance, and generate reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW="Analytics Overview"
|
||||||
|
COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW_PLACEHOLDER="Charts and metrics will appear here once tracking data is collected."
|
||||||
|
COM_MOKOSUITEANALYTICS_QUICK_LINKS="Quick Links"
|
||||||
|
COM_MOKOSUITEANALYTICS_PAGEVIEWS="Pageviews"
|
||||||
|
COM_MOKOSUITEANALYTICS_VISITORS="Visitors"
|
||||||
|
COM_MOKOSUITEANALYTICS_CAMPAIGNS="Campaigns"
|
||||||
|
COM_MOKOSUITEANALYTICS_REPORTS="Reports"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
COM_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
COM_MOKOSUITEANALYTICS_DESCRIPTION="Analytics — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_XML_DESCRIPTION="MokoSuiteAnalytics component for privacy-first site analytics and ad platform integration."
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
COM_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
COM_MOKOSUITEANALYTICS_DESCRIPTION="Analytics — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_DASHBOARD_TITLE="Analytics Dashboard"
|
||||||
|
COM_MOKOSUITEANALYTICS_DASHBOARD_DESC="Monitor site traffic, manage campaigns, review ad performance, and generate reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW="Analytics Overview"
|
||||||
|
COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW_PLACEHOLDER="Charts and metrics will appear here once tracking data is collected."
|
||||||
|
COM_MOKOSUITEANALYTICS_QUICK_LINKS="Quick Links"
|
||||||
|
COM_MOKOSUITEANALYTICS_PAGEVIEWS="Pageviews"
|
||||||
|
COM_MOKOSUITEANALYTICS_VISITORS="Visitors"
|
||||||
|
COM_MOKOSUITEANALYTICS_CAMPAIGNS="Campaigns"
|
||||||
|
COM_MOKOSUITEANALYTICS_REPORTS="Reports"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
COM_MOKOSUITEANALYTICS="MokoSuiteAnalytics"
|
||||||
|
COM_MOKOSUITEANALYTICS_DESCRIPTION="Analytics — privacy-first pageviews, visitor tracking, campaign management, ad platform integration, and scheduled reports."
|
||||||
|
COM_MOKOSUITEANALYTICS_XML_DESCRIPTION="MokoSuiteAnalytics component for privacy-first site analytics and ad platform integration."
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<extension type="component" method="upgrade">
|
||||||
|
<name>com_mokosuiteanalytics</name>
|
||||||
|
<version>01.00.01</version>
|
||||||
|
<creationDate>2026-06-11</creationDate>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<copyright>(C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<description>COM_MOKOSUITEANALYTICS_DESCRIPTION</description>
|
||||||
|
<namespace path="src">MokoConsulting\Component\MokoSuiteAnalytics</namespace>
|
||||||
|
<install>
|
||||||
|
<sql><file driver="mysql" charset="utf8">sql/install.mysql.sql</file></sql>
|
||||||
|
</install>
|
||||||
|
<uninstall>
|
||||||
|
<sql><file driver="mysql" charset="utf8">sql/uninstall.mysql.sql</file></sql>
|
||||||
|
</uninstall>
|
||||||
|
<update>
|
||||||
|
<schemas><schemapath type="mysql">sql/updates/mysql</schemapath></schemas>
|
||||||
|
</update>
|
||||||
|
<files folder=".">
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>sql</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/com_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/com_mokosuiteanalytics.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/com_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-US">en-US/com_mokosuiteanalytics.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
<administration>
|
||||||
|
<menu>COM_MOKOSUITEANALYTICS</menu>
|
||||||
|
</administration>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||||
|
use Joomla\CMS\Extension\ComponentInterface;
|
||||||
|
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
||||||
|
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
||||||
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use MokoConsulting\Component\MokoSuiteAnalytics\Administrator\Extension\MokoSuiteAnalyticsComponent;
|
||||||
|
|
||||||
|
return new class () implements ServiceProviderInterface {
|
||||||
|
public function register(Container $container): void
|
||||||
|
{
|
||||||
|
$container->registerServiceProvider(new MVCFactory('\\MokoConsulting\\Component\\MokoSuiteAnalytics'));
|
||||||
|
$container->registerServiceProvider(new ComponentDispatcherFactory('\\MokoConsulting\\Component\\MokoSuiteAnalytics'));
|
||||||
|
|
||||||
|
$container->set(
|
||||||
|
ComponentInterface::class,
|
||||||
|
function (Container $container) {
|
||||||
|
$component = new MokoSuiteAnalyticsComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||||
|
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||||
|
|
||||||
|
return $component;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_pageviews` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`page_url` VARCHAR(1024) NOT NULL DEFAULT '',
|
||||||
|
`page_title` VARCHAR(500) NOT NULL DEFAULT '',
|
||||||
|
`referrer_url` VARCHAR(1024) DEFAULT NULL,
|
||||||
|
`referrer_domain` VARCHAR(255) DEFAULT NULL,
|
||||||
|
`visitor_hash` VARCHAR(64) NOT NULL DEFAULT '',
|
||||||
|
`device_type` VARCHAR(20) DEFAULT NULL,
|
||||||
|
`browser` VARCHAR(100) DEFAULT NULL,
|
||||||
|
`os` VARCHAR(100) DEFAULT NULL,
|
||||||
|
`country_code` CHAR(2) DEFAULT NULL,
|
||||||
|
`session_id` VARCHAR(64) DEFAULT NULL,
|
||||||
|
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mokosuiteanalytics_pv_visitor` (`visitor_hash`),
|
||||||
|
KEY `idx_mokosuiteanalytics_pv_created` (`created_at`),
|
||||||
|
KEY `idx_mokosuiteanalytics_pv_url` (`page_url`(191))
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_visitors` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`visitor_hash` VARCHAR(64) NOT NULL,
|
||||||
|
`first_seen` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`last_seen` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`pageview_count` INT NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_mokosuiteanalytics_visitors_hash` (`visitor_hash`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_campaigns` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
`source` VARCHAR(100) DEFAULT NULL,
|
||||||
|
`medium` VARCHAR(100) DEFAULT NULL,
|
||||||
|
`campaign_code` VARCHAR(100) DEFAULT NULL,
|
||||||
|
`click_count` INT NOT NULL DEFAULT 0,
|
||||||
|
`conversion_count` INT NOT NULL DEFAULT 0,
|
||||||
|
`published` TINYINT(1) NOT NULL DEFAULT 1,
|
||||||
|
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_ad_accounts` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`platform` VARCHAR(50) NOT NULL DEFAULT '',
|
||||||
|
`account_id` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
`api_credentials` TEXT COMMENT 'Encrypted JSON',
|
||||||
|
`sync_enabled` TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
`last_sync` DATETIME DEFAULT NULL,
|
||||||
|
`published` TINYINT(1) NOT NULL DEFAULT 1,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_ad_metrics` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`ad_account_id` INT UNSIGNED NOT NULL,
|
||||||
|
`date` DATE NOT NULL,
|
||||||
|
`impressions` INT NOT NULL DEFAULT 0,
|
||||||
|
`clicks` INT NOT NULL DEFAULT 0,
|
||||||
|
`conversions` INT NOT NULL DEFAULT 0,
|
||||||
|
`spend` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
|
||||||
|
`revenue` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
|
||||||
|
`campaign_name` VARCHAR(255) DEFAULT NULL,
|
||||||
|
`ad_group_name` VARCHAR(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mokosuiteanalytics_adm_account_date` (`ad_account_id`, `date`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__mokosuiteanalytics_reports` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
`config` TEXT COMMENT 'JSON report configuration',
|
||||||
|
`schedule` VARCHAR(20) NOT NULL DEFAULT 'none',
|
||||||
|
`email_recipients` TEXT,
|
||||||
|
`created_by` INT NOT NULL DEFAULT 0,
|
||||||
|
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_reports`;
|
||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_ad_metrics`;
|
||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_ad_accounts`;
|
||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_campaigns`;
|
||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_visitors`;
|
||||||
|
DROP TABLE IF EXISTS `#__mokosuiteanalytics_pageviews`;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Component\MokoSuiteAnalytics\Administrator\Controller;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\Controller\BaseController;
|
||||||
|
|
||||||
|
final class DisplayController extends BaseController
|
||||||
|
{
|
||||||
|
protected $default_view = 'dashboard';
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Component\MokoSuiteAnalytics\Administrator\Extension;
|
||||||
|
|
||||||
|
use Joomla\CMS\Extension\MVCComponent;
|
||||||
|
|
||||||
|
final class MokoSuiteAnalyticsComponent extends MVCComponent
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Component\MokoSuiteAnalytics\Administrator\View\Dashboard;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
|
||||||
|
final class HtmlView extends BaseHtmlView
|
||||||
|
{
|
||||||
|
public function display($tpl = null): void
|
||||||
|
{
|
||||||
|
ToolbarHelper::title('MokoSuiteAnalytics — Dashboard', 'chart-line');
|
||||||
|
ToolbarHelper::preferences('com_mokosuiteanalytics');
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2><?php echo Text::_('COM_MOKOSUITEANALYTICS_DASHBOARD_TITLE'); ?></h2>
|
||||||
|
<p><?php echo Text::_('COM_MOKOSUITEANALYTICS_DASHBOARD_DESC'); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card mt-3">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4><?php echo Text::_('COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW'); ?></h4>
|
||||||
|
<p class="text-muted"><?php echo Text::_('COM_MOKOSUITEANALYTICS_ANALYTICS_OVERVIEW_PLACEHOLDER'); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4><?php echo Text::_('COM_MOKOSUITEANALYTICS_QUICK_LINKS'); ?></h4>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li><a href="<?php echo $this->escape('index.php?option=com_mokosuiteanalytics&view=pageviews'); ?>"><?php echo Text::_('COM_MOKOSUITEANALYTICS_PAGEVIEWS'); ?></a></li>
|
||||||
|
<li><a href="<?php echo $this->escape('index.php?option=com_mokosuiteanalytics&view=visitors'); ?>"><?php echo Text::_('COM_MOKOSUITEANALYTICS_VISITORS'); ?></a></li>
|
||||||
|
<li><a href="<?php echo $this->escape('index.php?option=com_mokosuiteanalytics&view=campaigns'); ?>"><?php echo Text::_('COM_MOKOSUITEANALYTICS_CAMPAIGNS'); ?></a></li>
|
||||||
|
<li><a href="<?php echo $this->escape('index.php?option=com_mokosuiteanalytics&view=reports'); ?>"><?php echo Text::_('COM_MOKOSUITEANALYTICS_REPORTS'); ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS="System - MokoSuiteAnalytics"
|
||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS_DESCRIPTION="System plugin for MokoSuiteAnalytics — injects tracking into page output."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS="System - MokoSuiteAnalytics"
|
||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS_DESCRIPTION="System plugin for MokoSuiteAnalytics — injects tracking into page output."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS="System - MokoSuiteAnalytics"
|
||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS_DESCRIPTION="System plugin for MokoSuiteAnalytics — injects tracking into page output."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS="System - MokoSuiteAnalytics"
|
||||||
|
PLG_SYSTEM_MOKOSUITEANALYTICS_DESCRIPTION="System plugin for MokoSuiteAnalytics — injects tracking into page output."
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<?php defined('_JEXEC') or die;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<extension type="plugin" group="system" method="upgrade">
|
||||||
|
<name>plg_system_mokosuiteanalytics</name>
|
||||||
|
<version>01.00.01</version>
|
||||||
|
<creationDate>2026-06-11</creationDate>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<description>PLG_SYSTEM_MOKOSUITEANALYTICS_DESCRIPTION</description>
|
||||||
|
<namespace path="src">MokoConsulting\Plugin\System\MokoSuiteAnalytics</namespace>
|
||||||
|
<files>
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/plg_system_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/plg_system_mokosuiteanalytics.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_system_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_system_mokosuiteanalytics.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Joomla\CMS\Extension\PluginInterface;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use Joomla\Event\DispatcherInterface;
|
||||||
|
use MokoConsulting\Plugin\System\MokoSuiteAnalytics\Extension\MokoSuiteAnalytics;
|
||||||
|
|
||||||
|
return new class () implements ServiceProviderInterface {
|
||||||
|
public function register(Container $container): void
|
||||||
|
{
|
||||||
|
$container->set(
|
||||||
|
PluginInterface::class,
|
||||||
|
function (Container $container) {
|
||||||
|
$plugin = new MokoSuiteAnalytics(
|
||||||
|
$container->get(DispatcherInterface::class),
|
||||||
|
(array) PluginHelper::getPlugin('system', 'mokosuiteanalytics')
|
||||||
|
);
|
||||||
|
$plugin->setApplication(\Joomla\CMS\Factory::getApplication());
|
||||||
|
return $plugin;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Plugin\System\MokoSuiteAnalytics\Extension;
|
||||||
|
|
||||||
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
|
use Joomla\Event\SubscriberInterface;
|
||||||
|
|
||||||
|
final class MokoSuiteAnalytics extends CMSPlugin implements SubscriberInterface
|
||||||
|
{
|
||||||
|
public static function getSubscribedEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'onAfterRender' => 'onAfterRender',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject tracking script into rendered page output.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function onAfterRender(): void
|
||||||
|
{
|
||||||
|
// TODO: Inject privacy-first tracking pixel / JS snippet before </body>
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_TASK_MOKOSUITEANALYTICS="Task - MokoSuiteAnalytics"
|
||||||
|
PLG_TASK_MOKOSUITEANALYTICS_DESCRIPTION="Task plugin for MokoSuiteAnalytics — daily hash rotation and data purge."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_TASK_MOKOSUITEANALYTICS="Task - MokoSuiteAnalytics"
|
||||||
|
PLG_TASK_MOKOSUITEANALYTICS_DESCRIPTION="Task plugin for MokoSuiteAnalytics — daily hash rotation and data purge."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_TASK_MOKOSUITEANALYTICS="Task - MokoSuiteAnalytics"
|
||||||
|
PLG_TASK_MOKOSUITEANALYTICS_DESCRIPTION="Task plugin for MokoSuiteAnalytics — daily hash rotation and data purge."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_TASK_MOKOSUITEANALYTICS="Task - MokoSuiteAnalytics"
|
||||||
|
PLG_TASK_MOKOSUITEANALYTICS_DESCRIPTION="Task plugin for MokoSuiteAnalytics — daily hash rotation and data purge."
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<extension type="plugin" group="task" method="upgrade">
|
||||||
|
<name>plg_task_mokosuiteanalytics</name>
|
||||||
|
<version>01.00.01</version>
|
||||||
|
<creationDate>2026-06-11</creationDate>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<description>PLG_TASK_MOKOSUITEANALYTICS_DESCRIPTION</description>
|
||||||
|
<namespace path="src">MokoConsulting\Plugin\Task\MokoSuiteAnalytics</namespace>
|
||||||
|
<files>
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/plg_task_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/plg_task_mokosuiteanalytics.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_task_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_task_mokosuiteanalytics.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Joomla\CMS\Extension\PluginInterface;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use Joomla\Event\DispatcherInterface;
|
||||||
|
use MokoConsulting\Plugin\Task\MokoSuiteAnalytics\Extension\MokoSuiteAnalyticsTask;
|
||||||
|
|
||||||
|
return new class () implements ServiceProviderInterface {
|
||||||
|
public function register(Container $container): void
|
||||||
|
{
|
||||||
|
$container->set(
|
||||||
|
PluginInterface::class,
|
||||||
|
function (Container $container) {
|
||||||
|
$plugin = new MokoSuiteAnalyticsTask(
|
||||||
|
$container->get(DispatcherInterface::class),
|
||||||
|
(array) PluginHelper::getPlugin('task', 'mokosuiteanalytics')
|
||||||
|
);
|
||||||
|
$plugin->setApplication(\Joomla\CMS\Factory::getApplication());
|
||||||
|
return $plugin;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Plugin\Task\MokoSuiteAnalytics\Extension;
|
||||||
|
|
||||||
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
|
use Joomla\Event\SubscriberInterface;
|
||||||
|
|
||||||
|
final class MokoSuiteAnalyticsTask extends CMSPlugin implements SubscriberInterface
|
||||||
|
{
|
||||||
|
public static function getSubscribedEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'onTaskOptionsList' => 'advertiseRoutines',
|
||||||
|
'onExecuteTask' => 'onExecuteTask',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advertise available task routines.
|
||||||
|
*/
|
||||||
|
public function advertiseRoutines($event): void
|
||||||
|
{
|
||||||
|
$event->addResult((object) [
|
||||||
|
'id' => 'mokosuiteanalytics.rotate_hash',
|
||||||
|
'title' => 'MokoSuiteAnalytics — Daily Hash Rotation',
|
||||||
|
]);
|
||||||
|
$event->addResult((object) [
|
||||||
|
'id' => 'mokosuiteanalytics.purge_data',
|
||||||
|
'title' => 'MokoSuiteAnalytics — Data Purge',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a scheduled task.
|
||||||
|
*/
|
||||||
|
public function onExecuteTask($event): void
|
||||||
|
{
|
||||||
|
$routineId = $event->getArgument('routineId');
|
||||||
|
|
||||||
|
if ($routineId === 'mokosuiteanalytics.rotate_hash') {
|
||||||
|
// TODO: Rotate visitor hash salt for privacy
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routineId === 'mokosuiteanalytics.purge_data') {
|
||||||
|
// TODO: Purge pageview data older than retention period
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS="Web Services - MokoSuiteAnalytics"
|
||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS_DESCRIPTION="Web services plugin for MokoSuiteAnalytics API routes."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS="Web Services - MokoSuiteAnalytics"
|
||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS_DESCRIPTION="Web services plugin for MokoSuiteAnalytics API routes."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS="Web Services - MokoSuiteAnalytics"
|
||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS_DESCRIPTION="Web services plugin for MokoSuiteAnalytics API routes."
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS="Web Services - MokoSuiteAnalytics"
|
||||||
|
PLG_WEBSERVICES_MOKOSUITEANALYTICS_DESCRIPTION="Web services plugin for MokoSuiteAnalytics API routes."
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<extension type="plugin" group="webservices" method="upgrade">
|
||||||
|
<name>plg_webservices_mokosuiteanalytics</name>
|
||||||
|
<version>01.00.01</version>
|
||||||
|
<creationDate>2026-06-11</creationDate>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<description>PLG_WEBSERVICES_MOKOSUITEANALYTICS_DESCRIPTION</description>
|
||||||
|
<namespace path="src">MokoConsulting\Plugin\WebServices\MokoSuiteAnalytics</namespace>
|
||||||
|
<files>
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/plg_webservices_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/plg_webservices_mokosuiteanalytics.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_webservices_mokosuiteanalytics.ini</language>
|
||||||
|
<language tag="en-US">en-US/plg_webservices_mokosuiteanalytics.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Joomla\CMS\Extension\PluginInterface;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use Joomla\Event\DispatcherInterface;
|
||||||
|
use MokoConsulting\Plugin\WebServices\MokoSuiteAnalytics\Extension\MokoSuiteAnalyticsWebServices;
|
||||||
|
|
||||||
|
return new class () implements ServiceProviderInterface {
|
||||||
|
public function register(Container $container): void
|
||||||
|
{
|
||||||
|
$container->set(PluginInterface::class, function (Container $container) {
|
||||||
|
return new MokoSuiteAnalyticsWebServices(
|
||||||
|
$container->get(DispatcherInterface::class),
|
||||||
|
(array) PluginHelper::getPlugin('webservices', 'mokosuiteanalytics')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MokoConsulting\Plugin\WebServices\MokoSuiteAnalytics\Extension;
|
||||||
|
|
||||||
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
|
use Joomla\Event\SubscriberInterface;
|
||||||
|
|
||||||
|
final class MokoSuiteAnalyticsWebServices extends CMSPlugin implements SubscriberInterface
|
||||||
|
{
|
||||||
|
public static function getSubscribedEvents(): array
|
||||||
|
{
|
||||||
|
return ['onBeforeApiRoute' => 'registerRoutes'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerRoutes($event): void
|
||||||
|
{
|
||||||
|
$router = $event->getArgument('router');
|
||||||
|
$router->createCRUDRoutes('v1/mokosuiteanalytics/pageviews', 'pageviews', ['component' => 'com_mokosuiteanalytics']);
|
||||||
|
$router->createCRUDRoutes('v1/mokosuiteanalytics/reports', 'reports', ['component' => 'com_mokosuiteanalytics']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<extension type="package" method="upgrade">
|
||||||
|
<name>MokoSuiteAnalytics</name>
|
||||||
|
<packagename>mokosuiteanalytics</packagename>
|
||||||
|
<version>01.00.01</version>
|
||||||
|
<creationDate>2026-06-11</creationDate>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<copyright>(C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<description>PKG_MOKOSUITEANALYTICS_DESCRIPTION</description>
|
||||||
|
<scriptfile>script.php</scriptfile>
|
||||||
|
<files folder="packages">
|
||||||
|
<file type="component" id="com_mokosuiteanalytics">com_mokosuiteanalytics</file>
|
||||||
|
<file type="plugin" id="plg_system_mokosuiteanalytics" group="system">plg_system_mokosuiteanalytics</file>
|
||||||
|
<file type="plugin" id="plg_webservices_mokosuiteanalytics" group="webservices">plg_webservices_mokosuiteanalytics</file>
|
||||||
|
<file type="plugin" id="plg_task_mokosuiteanalytics" group="task">plg_task_mokosuiteanalytics</file>
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/pkg_mokosuiteanalytics.sys.ini</language>
|
||||||
|
<language tag="en-US">en-US/pkg_mokosuiteanalytics.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Joomla\CMS\Installer\InstallerAdapter;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Log\Log;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class Pkg_MokoSuiteAnalyticsInstallerScript
|
||||||
|
{
|
||||||
|
protected string $minimumPhp = '8.1';
|
||||||
|
protected string $minimumJoomla = '5.0.0';
|
||||||
|
|
||||||
|
public function preflight(string $type, InstallerAdapter $adapter): bool
|
||||||
|
{
|
||||||
|
if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) {
|
||||||
|
Log::add(
|
||||||
|
sprintf('MokoSuiteAnalytics requires PHP %s or later. You are running PHP %s.', $this->minimumPhp, PHP_VERSION),
|
||||||
|
Log::WARNING,
|
||||||
|
'jerror'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postflight(string $type, InstallerAdapter $adapter): void
|
||||||
|
{
|
||||||
|
if ($type === 'install') {
|
||||||
|
// Enable plugins after first install
|
||||||
|
$this->enablePlugin('system', 'mokosuiteanalytics');
|
||||||
|
$this->enablePlugin('webservices', 'mokosuiteanalytics');
|
||||||
|
$this->enablePlugin('task', 'mokosuiteanalytics');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function enablePlugin(string $group, string $element): void
|
||||||
|
{
|
||||||
|
$db = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__extensions'))
|
||||||
|
->set($db->quoteName('enabled') . ' = 1')
|
||||||
|
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||||
|
->where($db->quoteName('folder') . ' = ' . $db->quote($group))
|
||||||
|
->where($db->quoteName('element') . ' = ' . $db->quote($element));
|
||||||
|
$db->setQuery($query)->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user