Compare commits
43 Commits
development
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 872889487e | |||
| 55ec926fdc | |||
| b4f916addb | |||
| a51f04c841 | |||
| db2ed26e65 | |||
| 509470b20b | |||
| 76254db28c | |||
| f176f424b5 | |||
| a5b94284cb | |||
| b24c563cc9 | |||
| d94909eb91 | |||
| 19590cef8c | |||
| d353b1ee36 | |||
| d07eb89f66 | |||
| 398fefe2fd | |||
| 5e33f94cce | |||
| e7cdc41648 | |||
| e3c15979b8 | |||
| 68ab5bdd44 | |||
| 1fe19fe5f1 | |||
| 17ef84e867 | |||
| 8d4a5b7a04 | |||
| 9fed55d5c0 | |||
| d79d5393be | |||
| 3cfe653b18 | |||
| 882a4bfb5c | |||
| d792b7ff0c | |||
| 68ffffe2af | |||
| 0fb82306bb | |||
| b170894228 | |||
| 082fa0798c | |||
| d1ee2ef3f4 | |||
| 7f9b59a36d | |||
| 79047e37b5 | |||
| 3d5f9346c6 | |||
| 93c82a9cee | |||
| 384b8824c6 | |||
| e01791ae68 | |||
| e42d6e7596 | |||
| d12971c0b7 | |||
| 21156deb0e | |||
| 1547bd5861 | |||
| f66871db2e |
+3
-3
@@ -107,7 +107,7 @@ replit.md
|
|||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.tgz
|
*.tgz
|
||||||
*.zip
|
*.zip
|
||||||
!src/payload/*.zip
|
!source/payload/*.zip
|
||||||
artifacts/
|
artifacts/
|
||||||
release/
|
release/
|
||||||
releases/
|
releases/
|
||||||
@@ -122,7 +122,7 @@ build/
|
|||||||
dist/
|
dist/
|
||||||
out/
|
out/
|
||||||
site/
|
site/
|
||||||
!src/packages/*/site/
|
!source/packages/*/site/
|
||||||
*.map
|
*.map
|
||||||
*.css.map
|
*.css.map
|
||||||
*.js.map
|
*.js.map
|
||||||
@@ -161,7 +161,7 @@ package-lock.json
|
|||||||
# PHP / Composer tooling
|
# PHP / Composer tooling
|
||||||
# ============================================================
|
# ============================================================
|
||||||
vendor/
|
vendor/
|
||||||
!src/media/vendor/
|
!source/media/vendor/
|
||||||
composer.lock
|
composer.lock
|
||||||
*.phar
|
*.phar
|
||||||
codeception.phar
|
codeception.phar
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
[submodule "src/packages/tpl_mokoonyx"]
|
|
||||||
path = src/packages/tpl_mokoonyx
|
|
||||||
url = https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx.git
|
|
||||||
branch = main
|
|
||||||
|
|||||||
+61
-295
@@ -1,316 +1,82 @@
|
|||||||
<!--
|
# MokoWaaS
|
||||||
Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
|
|
||||||
This file is part of a Moko Consulting project.
|
Joomla 5/6 admin tools suite — heartbeat health monitoring, extension management, security firewall, tenant restrictions, and site administration.
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
## Quick Reference
|
||||||
|
|
||||||
# FILE INFORMATION
|
| Field | Value |
|
||||||
DEFGROUP: MokoStandards.Templates.GitHub
|
|---|---|
|
||||||
INGROUP: MokoStandards.Templates
|
| **Package** | `pkg_mokowaas` |
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
| **Language** | PHP 8.1+ |
|
||||||
PATH: /templates/github/copilot-instructions.joomla.md.template
|
| **Branch** | develop on `dev`, merge to `main` (protected) |
|
||||||
VERSION: XX.YY.ZZ
|
| **Wiki** | [MokoWaaS Wiki](https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS/wiki) |
|
||||||
BRIEF: GitHub Copilot custom instructions template for Joomla/MokoWaaS governed repositories
|
|
||||||
NOTE: Synced to .github/copilot-instructions.md in all Joomla/WaaS repos via bulk sync.
|
|
||||||
Tokens replaced at sync time: MokoWaaS, https://github.com/mokoconsulting-tech/MokoWaaS, {{EXTENSION_NAME}},
|
|
||||||
{{EXTENSION_TYPE}}, {{EXTENSION_ELEMENT}}
|
|
||||||
-->
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
## Commands
|
||||||
> **🔧 AI Self-Update Required on First Use**
|
|
||||||
>
|
|
||||||
> This file may contain unfilled `{{TOKEN}}` placeholders. The MokoStandards bulk-sync system
|
|
||||||
> replaces them automatically at sync time; if you can still see them, sync has not yet run for
|
|
||||||
> this repository — or this is a brand-new repo.
|
|
||||||
>
|
|
||||||
> **On your very first interaction in this repository, before answering any other question:**
|
|
||||||
>
|
|
||||||
> 1. Check whether any `{{TOKEN}}` placeholders remain in this file.
|
|
||||||
> 2. If they do, locate the values as described in the table below and replace every occurrence
|
|
||||||
> in **both** `.github/copilot-instructions.md` and `.github/CLAUDE.md`.
|
|
||||||
> 3. After replacing all tokens, **delete this entire notice block** (from `> [!IMPORTANT]`
|
|
||||||
> through the closing `> ---` line) in both files.
|
|
||||||
> 4. Tell the developer: *"I've self-updated the AI context files with this repository's
|
|
||||||
> values — all set."*
|
|
||||||
>
|
|
||||||
> | Placeholder | Where to find the value |
|
|
||||||
> |---|---|
|
|
||||||
> | `MokoWaaS` | The GitHub repository name (visible in the URL, `README.md` heading, or `git remote -v`) |
|
|
||||||
> | `https://github.com/mokoconsulting-tech/MokoWaaS` | Full GitHub URL, e.g. `https://github.com/mokoconsulting-tech/<repo-name>` |
|
|
||||||
> | `{{EXTENSION_NAME}}` | The `<name>` element in `manifest.xml` at the repository root |
|
|
||||||
> | `{{EXTENSION_TYPE}}` | The `type` attribute of the `<extension>` tag in `manifest.xml` (`component`, `module`, `plugin`, or `template`) |
|
|
||||||
> | `{{EXTENSION_ELEMENT}}` | The `<element>` tag in `manifest.xml`, or the filename prefix (e.g. `com_myextension`, `mod_mymodule`) |
|
|
||||||
>
|
|
||||||
> ---
|
|
||||||
|
|
||||||
# MokoWaaS — GitHub Copilot Custom Instructions
|
```bash
|
||||||
|
composer install # Install PHP dependencies
|
||||||
## What This Repo Is
|
|
||||||
|
|
||||||
This is a **Moko Consulting MokoWaaS** (Joomla) repository governed by [MokoStandards](https://github.com/mokoconsulting-tech/MokoStandards). All coding standards, workflows, and policies are defined there and enforced here via bulk sync.
|
|
||||||
|
|
||||||
Repository URL: https://github.com/mokoconsulting-tech/MokoWaaS
|
|
||||||
Extension name: **{{EXTENSION_NAME}}**
|
|
||||||
Extension type: **{{EXTENSION_TYPE}}** (`{{EXTENSION_ELEMENT}}`)
|
|
||||||
Platform: **Joomla 4.x / MokoWaaS**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Primary Language
|
|
||||||
|
|
||||||
**PHP** (≥ 7.4) is the primary language for this Joomla extension. JavaScript may be used for frontend enhancements. YAML uses 2-space indentation. All other text files use tabs per `.editorconfig`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## File Header — Always Required on New Files
|
|
||||||
|
|
||||||
Every new file needs a copyright header as its first content.
|
|
||||||
|
|
||||||
**PHP:**
|
|
||||||
```php
|
|
||||||
<?php
|
|
||||||
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
*
|
|
||||||
* This file is part of a Moko Consulting project.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*
|
|
||||||
* FILE INFORMATION
|
|
||||||
* DEFGROUP: MokoWaaS.{{EXTENSION_TYPE}}
|
|
||||||
* INGROUP: MokoWaaS
|
|
||||||
* REPO: https://github.com/mokoconsulting-tech/MokoWaaS
|
|
||||||
* PATH: /path/to/file.php
|
|
||||||
* VERSION: XX.YY.ZZ
|
|
||||||
* BRIEF: One-line description of purpose
|
|
||||||
*/
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Markdown:**
|
## Architecture
|
||||||
```markdown
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
|
|
||||||
This file is part of a Moko Consulting project.
|
Joomla **package** (`pkg_mokowaas`) with 17 sub-extensions:
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
### Core Plugin (`plg_system_mokowaas`)
|
||||||
|
- Heartbeat health endpoint (`/?mokowaas=health`) with 16 diagnostic checks
|
||||||
|
- Grafana provisioning and heartbeat sender
|
||||||
|
- Site alias / domain management
|
||||||
|
- Extension cascade (enable/disable coordination)
|
||||||
|
- Download key preservation across Joomla updates
|
||||||
|
- Namespace: `Moko\Plugin\System\MokoWaaS`
|
||||||
|
|
||||||
# FILE INFORMATION
|
### Feature Plugins
|
||||||
DEFGROUP: MokoWaaS.Documentation
|
- `plg_system_mokowaas_firewall` — WAF, IP blocklist, security headers, password policy
|
||||||
INGROUP: MokoWaaS
|
- `plg_system_mokowaas_tenant` — admin restrictions for non-master users
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoWaaS
|
- `plg_system_mokowaas_devtools` — dev mode, hit reset, version cleanup, download key reset
|
||||||
PATH: /docs/file.md
|
- `plg_system_mokowaas_offline` — offline mode bypass for legal pages
|
||||||
VERSION: XX.YY.ZZ
|
- `plg_system_mokowaas_monitor` — Grafana heartbeat registration
|
||||||
BRIEF: One-line description
|
|
||||||
-->
|
|
||||||
```
|
|
||||||
|
|
||||||
**YAML / Shell / XML:** Use the appropriate comment syntax with the same fields. JSON files are exempt.
|
### Component (`com_mokowaas`)
|
||||||
|
- Admin dashboard with plugin management, WAF charts, extension catalog
|
||||||
|
- Helpdesk ticketing system
|
||||||
|
- REST API controllers
|
||||||
|
|
||||||
---
|
### Modules
|
||||||
|
- `mod_mokowaas_cpanel` — admin dashboard widget
|
||||||
|
- `mod_mokowaas_menu` — admin sidebar menu
|
||||||
|
- `mod_mokowaas_cache` — status bar cache/temp cleaner
|
||||||
|
- `mod_mokowaas_categories` — auto-category tree menu
|
||||||
|
|
||||||
## Version Management
|
### Task Plugins
|
||||||
|
- `plg_task_mokowaasdemo` — scheduled demo site reset
|
||||||
|
- `plg_task_mokowaassync` — scheduled content sync
|
||||||
|
- `plg_task_mokowaas_tickets` — ticket automation
|
||||||
|
|
||||||
**`README.md` is the single source of truth for the repository version.**
|
### Update Server
|
||||||
|
|
||||||
- **Bump the patch version on every PR** — increment `XX.YY.ZZ` (e.g. `01.02.03` → `01.02.04`) in `README.md` before opening the PR; the `sync-version-on-merge` workflow propagates it automatically to all badges and `FILE INFORMATION` headers on merge to `main`.
|
MokoGitea generates update feeds dynamically from releases — no static `updates.xml` needed.
|
||||||
- The `VERSION: XX.YY.ZZ` field in `README.md` governs all other version references.
|
|
||||||
- Version format is zero-padded semver: `XX.YY.ZZ` (e.g. `01.02.03`).
|
|
||||||
- Never hardcode a specific version in document body text — use the badge or FILE INFORMATION header only.
|
|
||||||
|
|
||||||
### Joomla Version Alignment
|
## Source Directory
|
||||||
|
|
||||||
The version in `README.md` **must always match** the `<version>` tag in `manifest.xml` and the latest entry in `updates.xml`. The `make release` command / release workflow updates all three automatically.
|
Source lives in `source/` (not `src/`):
|
||||||
|
- `source/pkg_mokowaas.xml` — package manifest
|
||||||
|
- `source/script.php` — install script
|
||||||
|
- `source/packages/` — all sub-extensions
|
||||||
|
|
||||||
```xml
|
## Rules
|
||||||
<!-- In manifest.xml — must match README.md version -->
|
|
||||||
<version>01.02.04</version>
|
|
||||||
|
|
||||||
<!-- In updates.xml — prepend a new <update> block for every release.
|
- **Never commit** `.claude/`, `.mcp.json`, `TODO.md`, `*.min.css`/`*.min.js`
|
||||||
Note: the backslash in version="4\.[0-9]+" is a literal backslash character
|
- **Attribution**: `Authored-by: Moko Consulting`
|
||||||
in the XML attribute value. Joomla's update server treats the value as a
|
- **Workflow directory**: `.mokogitea/` (not `.gitea/` or `.github/`)
|
||||||
regular expression, so \. matches a literal dot. -->
|
- **Minification**: handled at build time (CI)
|
||||||
<updates>
|
- **Wiki**: documentation lives in the Gitea wiki, not `docs/` files
|
||||||
<update>
|
- **Standards**: [moko-platform](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home)
|
||||||
<name>{{EXTENSION_NAME}}</name>
|
|
||||||
<version>01.02.04</version>
|
|
||||||
<downloads>
|
|
||||||
<downloadurl type="full" format="zip">
|
|
||||||
https://github.com/mokoconsulting-tech/MokoWaaS/releases/download/01.02.04/{{EXTENSION_ELEMENT}}-01.02.04.zip
|
|
||||||
</downloadurl>
|
|
||||||
</downloads>
|
|
||||||
<targetplatform name="joomla" version="4\.[0-9]+" />
|
|
||||||
</update>
|
|
||||||
<!-- … older entries preserved below … -->
|
|
||||||
</updates>
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
## Coding Standards
|
||||||
|
|
||||||
## Joomla Extension Structure
|
- PHP 8.1+ minimum
|
||||||
|
- Joomla 5/6 DI container pattern: `services/provider.php` → Extension class
|
||||||
```
|
- `SubscriberInterface` for event subscription
|
||||||
MokoWaaS/
|
- Joomla 5/6 dual-compat for events: check `is_object($event)` with `getArgument()` fallback
|
||||||
├── manifest.xml # Joomla installer manifest (root — required)
|
- SPDX license headers on all PHP files
|
||||||
├── (no updates.xml) # Update XML is generated dynamically by MokoGitea
|
- `defined('_JEXEC') or die;` on all web-accessible PHP files
|
||||||
├── site/ # Frontend (site) code
|
|
||||||
│ ├── controller.php
|
|
||||||
│ ├── controllers/
|
|
||||||
│ ├── models/
|
|
||||||
│ └── views/
|
|
||||||
├── admin/ # Backend (admin) code
|
|
||||||
│ ├── controller.php
|
|
||||||
│ ├── controllers/
|
|
||||||
│ ├── models/
|
|
||||||
│ ├── views/
|
|
||||||
│ └── sql/
|
|
||||||
├── language/ # Language INI files
|
|
||||||
├── media/ # CSS, JS, images (deployed to /media/{{EXTENSION_ELEMENT}}/)
|
|
||||||
├── docs/ # Technical documentation
|
|
||||||
├── tests/ # Test suite
|
|
||||||
├── .github/
|
|
||||||
│ ├── workflows/
|
|
||||||
│ ├── copilot-instructions.md # This file
|
|
||||||
│ └── CLAUDE.md
|
|
||||||
├── README.md # Version source of truth
|
|
||||||
├── CHANGELOG.md
|
|
||||||
├── CONTRIBUTING.md
|
|
||||||
├── LICENSE # GPL-3.0-or-later
|
|
||||||
└── Makefile # Build automation
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Update Server — MokoGitea Dynamic Endpoint
|
|
||||||
|
|
||||||
`updates.xml` is **NOT** stored in the repo. MokoGitea generates the update XML dynamically from git releases at:
|
|
||||||
|
|
||||||
```
|
|
||||||
https://git.mokoconsulting.tech/{Owner}/{Repo}/updates.xml
|
|
||||||
```
|
|
||||||
|
|
||||||
The package manifest (`pkg_mokowaas.xml`) references it via:
|
|
||||||
```xml
|
|
||||||
<updateservers>
|
|
||||||
<server type="extension" priority="1" name="MokoWaaS Update Server">
|
|
||||||
https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS/updates.xml
|
|
||||||
</server>
|
|
||||||
</updateservers>
|
|
||||||
```
|
|
||||||
|
|
||||||
**License Key (Download Key):**
|
|
||||||
- MokoGitea's endpoint validates license keys passed as `?dlid=MOKO-XXXX-XXXX-XXXX-XXXX`
|
|
||||||
- The generated XML includes `<downloadkey prefix="dlid=" suffix="" />` to tell Joomla a key is required
|
|
||||||
- Users enter the download key via Joomla's native **System → Update Sites** interface
|
|
||||||
- Joomla stores the key in `#__update_sites.extra_query` and appends it to all update/download requests
|
|
||||||
- Invalid/expired keys receive an empty `<updates></updates>` response
|
|
||||||
|
|
||||||
**Rules:**
|
|
||||||
- Do NOT create or commit a static `updates.xml` — MokoGitea generates it from releases
|
|
||||||
- The `<version>` in release tags must match `<version>` in the manifest and `README.md`
|
|
||||||
- Release assets (ZIPs) must be attached to git releases — MokoGitea uses them for `<downloadurl>`
|
|
||||||
- `<targetplatform name="joomla" version="(5|6)\..*">` — the backslash is a **literal backslash character** in the XML attribute value; Joomla's update-server parser treats the value as a regular expression
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## manifest.xml Rules
|
|
||||||
|
|
||||||
- Lives at the repo root as `manifest.xml` (not inside `site/` or `admin/`).
|
|
||||||
- `<version>` tag must be kept in sync with `README.md` version and `updates.xml`.
|
|
||||||
- Must include `<updateservers>` block pointing to this repo's `updates.xml`.
|
|
||||||
- Must include `<files folder="site">` and `<administration>` sections.
|
|
||||||
- Joomla 4.x requires `<namespace path="src">Moko\{{EXTENSION_NAME}}</namespace>` for namespaced extensions.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## GitHub Actions — Token Usage
|
|
||||||
|
|
||||||
Every workflow must use **`secrets.GH_TOKEN`** (the org-level Personal Access Token).
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# ✅ Correct
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# ❌ Wrong — never use these in workflows
|
|
||||||
token: ${{ github.token }}
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## MokoStandards Reference
|
|
||||||
|
|
||||||
This repository is governed by [MokoStandards](https://github.com/mokoconsulting-tech/MokoStandards). Authoritative policies:
|
|
||||||
|
|
||||||
| Document | Purpose |
|
|
||||||
|----------|---------|
|
|
||||||
| [file-header-standards.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/policy/file-header-standards.md) | Copyright-header rules for every file type |
|
|
||||||
| [coding-style-guide.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/policy/coding-style-guide.md) | Naming and formatting conventions |
|
|
||||||
| [branching-strategy.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/policy/branching-strategy.md) | Branch naming, hierarchy, and release workflow |
|
|
||||||
| [merge-strategy.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/policy/merge-strategy.md) | Squash-merge policy and PR title/body conventions |
|
|
||||||
| [changelog-standards.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/policy/changelog-standards.md) | How and when to update CHANGELOG.md |
|
|
||||||
| [joomla-development-guide.md](https://github.com/mokoconsulting-tech/MokoStandards/blob/main/docs/guide/waas/joomla-development-guide.md) | MokoWaaS Joomla extension development guide |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Naming Conventions
|
|
||||||
|
|
||||||
| Context | Convention | Example |
|
|
||||||
|---------|-----------|---------|
|
|
||||||
| PHP class | `PascalCase` | `MyController` |
|
|
||||||
| PHP method / function | `camelCase` | `getItems()` |
|
|
||||||
| PHP variable | `$snake_case` | `$item_id` |
|
|
||||||
| PHP constant | `UPPER_SNAKE_CASE` | `MAX_ITEMS` |
|
|
||||||
| PHP class file | `PascalCase.php` | `ItemModel.php` |
|
|
||||||
| YAML workflow | `kebab-case.yml` | `ci-joomla.yml` |
|
|
||||||
| Markdown doc | `kebab-case.md` | `installation-guide.md` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Commit Messages
|
|
||||||
|
|
||||||
Format: `<type>(<scope>): <subject>` — imperative, lower-case subject, no trailing period.
|
|
||||||
|
|
||||||
Valid types: `feat` · `fix` · `docs` · `chore` · `ci` · `refactor` · `style` · `test` · `perf` · `revert` · `build`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Branch Naming
|
|
||||||
|
|
||||||
Format: `<prefix>/<MAJOR.MINOR.PATCH>[/description]`
|
|
||||||
|
|
||||||
Approved prefixes: `dev/` · `rc/` · `version/` · `patch/` · `copilot/` · `dependabot/`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Keeping Documentation Current
|
|
||||||
|
|
||||||
| Change type | Documentation to update |
|
|
||||||
|-------------|------------------------|
|
|
||||||
| New or renamed PHP class/method | PHPDoc block; `docs/api/` entry |
|
|
||||||
| New or changed manifest.xml | Bump README.md version |
|
|
||||||
| New release | Create git release with ZIP asset; update CHANGELOG.md; bump README.md version |
|
|
||||||
| New or changed workflow | `docs/workflows/<workflow-name>.md` |
|
|
||||||
| Any modified file | Update the `VERSION` field in that file's `FILE INFORMATION` block |
|
|
||||||
| **Every PR** | **Bump the patch version** — increment `XX.YY.ZZ` in `README.md`; `sync-version-on-merge` propagates it |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Key Constraints
|
|
||||||
|
|
||||||
- Never commit directly to `main` — all changes go via PR, squash-merged
|
|
||||||
- Never skip the FILE INFORMATION block on a new file
|
|
||||||
- Never add `defined('_JEXEC') or die;` to CLI scripts or model tests — only to web-accessible PHP files
|
|
||||||
- Never hardcode version numbers in body text — update `README.md` and let automation propagate
|
|
||||||
- Never use `github.token` or `secrets.GITHUB_TOKEN` in workflows — always use `secrets.GH_TOKEN`
|
|
||||||
- Never let `manifest.xml` version and `README.md` version go out of sync
|
|
||||||
- Never commit a static `updates.xml` — the update feed is generated dynamically by MokoGitea
|
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
<display-name>Package - MokoWaaS</display-name>
|
<display-name>Package - MokoWaaS</display-name>
|
||||||
<org>MokoConsulting</org>
|
<org>MokoConsulting</org>
|
||||||
<description>White-label identity, security hardening, and tenant restriction layer for WaaS-managed Joomla environments</description>
|
<description>White-label identity, security hardening, and tenant restriction layer for WaaS-managed Joomla environments</description>
|
||||||
<version>02.34.08</version>
|
<<<<<<< HEAD
|
||||||
|
<version>02.34.00</version>
|
||||||
|
=======
|
||||||
|
<version>02.34.16</version>
|
||||||
|
>>>>>>> origin/dev
|
||||||
<license spdx="GPL-3.0-or-later">GNU General Public License v3</license>
|
<license spdx="GPL-3.0-or-later">GNU General Public License v3</license>
|
||||||
</identity>
|
</identity>
|
||||||
<governance>
|
<governance>
|
||||||
@@ -21,6 +25,6 @@
|
|||||||
<build>
|
<build>
|
||||||
<language>PHP</language>
|
<language>PHP</language>
|
||||||
<package-type>package</package-type>
|
<package-type>package</package-type>
|
||||||
<entry-point>src/</entry-point>
|
<entry-point>source/</entry-point>
|
||||||
</build>
|
</build>
|
||||||
</moko-platform>
|
</moko-platform>
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: moko-platform.Automation
|
# INGROUP: moko-platform.Automation
|
||||||
# VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
# VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
# VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
# 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"
|
||||||
|
|||||||
@@ -63,15 +63,22 @@ jobs:
|
|||||||
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
MOKO_CLONE_HOST: git.mokoconsulting.tech/MokoConsulting
|
||||||
run: |
|
run: |
|
||||||
if ! command -v composer &> /dev/null; then
|
# Use pre-installed /opt/moko-platform if available (updated by cron every 6h)
|
||||||
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
|
if [ -f “/opt/moko-platform/cli/version_bump.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; 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
|
||||||
|
git clone --depth 1 --branch main --quiet \
|
||||||
|
“https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/moko-platform.git” \
|
||||||
|
/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
|
fi
|
||||||
rm -rf /tmp/moko-platform-api
|
|
||||||
git clone --depth 1 --branch main --quiet \
|
|
||||||
"https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/moko-platform.git" \
|
|
||||||
/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"
|
|
||||||
|
|
||||||
- name: Detect platform
|
- name: Detect platform
|
||||||
id: platform
|
id: platform
|
||||||
|
|||||||
+5
-1
@@ -14,7 +14,11 @@
|
|||||||
INGROUP: MokoWaaS.Documentation
|
INGROUP: MokoWaaS.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
PATH: ./CHANGELOG.md
|
PATH: ./CHANGELOG.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
BRIEF: Version history using `Keep a Changelog`
|
BRIEF: Version history using `Keep a Changelog`
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# CLAUDE.md
|
|
||||||
|
|
||||||
This file provides guidance to Claude Code when working with this repository.
|
|
||||||
|
|
||||||
## Project Overview
|
|
||||||
|
|
||||||
**MokoWaaS** -- MokoWaaS is a Joomla 5.x / 6.x system plugin that provides a configurable white-label identity layer for the MokoWaaS platform.
|
|
||||||
|
|
||||||
| Field | Value |
|
|
||||||
|---|---|
|
|
||||||
| **Platform** | joomla |
|
|
||||||
| **Language** | PHP |
|
|
||||||
| **Default branch** | main |
|
|
||||||
| **License** | GPL-3.0-or-later |
|
|
||||||
| **Wiki** | [MokoWaaS Wiki](https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS/wiki) |
|
|
||||||
| **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) |
|
|
||||||
|
|
||||||
## Common Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
composer install # Install PHP dependencies
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
This is a Joomla extension. Key directories:
|
|
||||||
- `src/` -- extension source (deployed to Joomla)
|
|
||||||
- `src/*.xml` -- manifest file (version, files, params)
|
|
||||||
- `src/src/` or `src/services/` -- PHP classes
|
|
||||||
- `src/language/` -- translation strings
|
|
||||||
- `src/media/` -- CSS/JS/images
|
|
||||||
|
|
||||||
## Rules
|
|
||||||
|
|
||||||
- **Workflow directory**: `.mokogitea/` (not `.gitea/` or `.github/`)
|
|
||||||
|
|
||||||
- **Never commit** `.claude/`, `.mcp.json`, `TODO.md`, or `*.min.css`/`*.min.js`
|
|
||||||
- **Attribution**: use `Authored-by: Moko Consulting` in commits
|
|
||||||
- **Branch strategy**: develop on `dev`, merge to `main` for release
|
|
||||||
- **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates)
|
|
||||||
- **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files
|
|
||||||
- **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home)
|
|
||||||
+5
-1
@@ -14,7 +14,11 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Documentation
|
INGROUP: MokoWaaS.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: ./CODE_OF_CONDUCT.md
|
PATH: ./CODE_OF_CONDUCT.md
|
||||||
BRIEF: Reference + packaging repo for Moko Consulting Developer GPT Other Default
|
BRIEF: Reference + packaging repo for Moko Consulting Developer GPT Other Default
|
||||||
-->
|
-->
|
||||||
|
|||||||
+5
-1
@@ -19,7 +19,11 @@
|
|||||||
DEFGROUP: mokoconsulting-tech.MokoWaaSBrand
|
DEFGROUP: mokoconsulting-tech.MokoWaaSBrand
|
||||||
INGROUP: MokoStandards.Governance
|
INGROUP: MokoStandards.Governance
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoWaaSBrand
|
REPO: https://github.com/mokoconsulting-tech/MokoWaaSBrand
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /GOVERNANCE.md
|
PATH: /GOVERNANCE.md
|
||||||
BRIEF: Project governance rules, roles, and decision process for MokoWaaSBrand
|
BRIEF: Project governance rules, roles, and decision process for MokoWaaSBrand
|
||||||
-->
|
-->
|
||||||
|
|||||||
+5
-1
@@ -15,7 +15,11 @@
|
|||||||
INGROUP: MokoWaaS.Documentation
|
INGROUP: MokoWaaS.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
PATH: ./LICENSE.md
|
PATH: ./LICENSE.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
BRIEF: Project license (GPL-3.0-or-later)
|
BRIEF: Project license (GPL-3.0-or-later)
|
||||||
-->
|
-->
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS
|
INGROUP: MokoWaaS
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /README.md
|
PATH: /README.md
|
||||||
BRIEF: MokoWaaS platform plugin for Joomla
|
BRIEF: MokoWaaS platform plugin for Joomla
|
||||||
-->
|
-->
|
||||||
|
|||||||
+5
-1
@@ -23,7 +23,11 @@ DEFGROUP: [PROJECT_NAME]
|
|||||||
INGROUP: [PROJECT_NAME].Documentation
|
INGROUP: [PROJECT_NAME].Documentation
|
||||||
REPO: [REPOSITORY_URL]
|
REPO: [REPOSITORY_URL]
|
||||||
PATH: /SECURITY.md
|
PATH: /SECURITY.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
BRIEF: Security vulnerability reporting and handling policy
|
BRIEF: Security vulnerability reporting and handling policy
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,21 @@
|
|||||||
INGROUP: MokoWaaS.Build
|
INGROUP: MokoWaaS.Build
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
FILE: build-guide.md
|
FILE: build-guide.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/
|
PATH: /docs/guides/
|
||||||
BRIEF: Build and packaging guide for the MokoWaaS system plugin
|
BRIEF: Build and packaging guide for the MokoWaaS system plugin
|
||||||
NOTE: Defines environment setup, repository layout, packaging rules, and release preparation
|
NOTE: Defines environment setup, repository layout, packaging rules, and release preparation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Build Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Build Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Build Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## 1. Purpose
|
## 1. Purpose
|
||||||
|
|
||||||
@@ -44,7 +52,7 @@ The repository should maintain a clean, predictable, and modular structure suita
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
mokowaas/
|
mokowaas/
|
||||||
├── src/
|
├── source/
|
||||||
│ ├── mokowaas.php (main plugin file)
|
│ ├── mokowaas.php (main plugin file)
|
||||||
│ ├── mokowaas.xml (plugin manifest)
|
│ ├── mokowaas.xml (plugin manifest)
|
||||||
│ ├── services/ (service providers for DI)
|
│ ├── services/ (service providers for DI)
|
||||||
@@ -192,7 +200,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Lint PHP and syntax check
|
- name: Lint PHP and syntax check
|
||||||
run: |
|
run: |
|
||||||
echo "[INFO] Run php -l over src/ and any additional linting as needed."
|
echo "[INFO] Run php -l over source/ and any additional linting as needed."
|
||||||
|
|
||||||
- name: Create build artifact
|
- name: Create build artifact
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/configuration-guide.md
|
PATH: /docs/guides/configuration-guide.md
|
||||||
BRIEF: Configuration guide for the MokoWaaS system plugin
|
BRIEF: Configuration guide for the MokoWaaS system plugin
|
||||||
NOTE: Defines plugin parameters, expected behaviors, and recommended defaults
|
NOTE: Defines plugin parameters, expected behaviors, and recommended defaults
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Configuration Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Configuration Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Configuration Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## 1. Objective
|
## 1. Objective
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/installation-guide.md
|
PATH: /docs/guides/installation-guide.md
|
||||||
BRIEF: Installation guide for the MokoWaaS system plugin
|
BRIEF: Installation guide for the MokoWaaS system plugin
|
||||||
NOTE: First document in the guide set
|
NOTE: First document in the guide set
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Installation Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Installation Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Installation Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/operations-guide.md
|
PATH: /docs/guides/operations-guide.md
|
||||||
BRIEF: Operational guide for administering and managing the MokoWaaS system plugin
|
BRIEF: Operational guide for administering and managing the MokoWaaS system plugin
|
||||||
NOTE: Defines lifecycle, responsibilities, and operational behaviors
|
NOTE: Defines lifecycle, responsibilities, and operational behaviors
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Operations Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Operations Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Operations Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/rollback-and-recovery-guide.md
|
PATH: /docs/guides/rollback-and-recovery-guide.md
|
||||||
BRIEF: Rollback and recovery guide for restoring stable operation after plugin related incidents
|
BRIEF: Rollback and recovery guide for restoring stable operation after plugin related incidents
|
||||||
NOTE: Completes the core guide set for WaaS plugin governance
|
NOTE: Completes the core guide set for WaaS plugin governance
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Rollback and Recovery Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Rollback and Recovery Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Rollback and Recovery Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/testing-guide.md
|
PATH: /docs/guides/testing-guide.md
|
||||||
BRIEF: Testing guide for MokoWaaS v02.01.08
|
BRIEF: Testing guide for MokoWaaS v02.01.08
|
||||||
NOTE: Covers manual test procedures for language overrides, install/uninstall, and configuration
|
NOTE: Covers manual test procedures for language overrides, install/uninstall, and configuration
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Testing Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Testing Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Testing Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## 1. Prerequisites
|
## 1. Prerequisites
|
||||||
|
|
||||||
@@ -27,7 +35,7 @@
|
|||||||
|
|
||||||
1. Clean Joomla 5.x installation OR existing site with custom language overrides.
|
1. Clean Joomla 5.x installation OR existing site with custom language overrides.
|
||||||
2. Admin account with Super User access.
|
2. Admin account with Super User access.
|
||||||
3. Build the plugin package: `make package` or zip the `src/` directory.
|
3. Build the plugin package: `make package` or zip the `source/` directory.
|
||||||
|
|
||||||
## 2. Test Suites
|
## 2. Test Suites
|
||||||
|
|
||||||
@@ -278,19 +286,19 @@ Run from the project root:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Lint all PHP files
|
# Lint all PHP files
|
||||||
php -l src/script.php
|
php -l source/script.php
|
||||||
php -l src/Extension/MokoWaaS.php
|
php -l source/Extension/MokoWaaS.php
|
||||||
|
|
||||||
# Verify all override files have placeholders (no hardcoded "MokoWaaS" in values)
|
# Verify all override files have placeholders (no hardcoded "MokoWaaS" in values)
|
||||||
grep -r '"MokoWaaS' src/language/overrides/ src/administrator/language/overrides/
|
grep -r '"MokoWaaS' source/language/overrides/ source/administrator/language/overrides/
|
||||||
# Expected: no output (all values should use {{BRAND_NAME}})
|
# Expected: no output (all values should use {{BRAND_NAME}})
|
||||||
|
|
||||||
# Verify sentinel constants match
|
# Verify sentinel constants match
|
||||||
grep -c 'BLOCK_START\|BLOCK_END' src/script.php
|
grep -c 'BLOCK_START\|BLOCK_END' source/script.php
|
||||||
# Expected: 6+ references
|
# Expected: 6+ references
|
||||||
|
|
||||||
# Verify all .ini files have version 02.01.08
|
# Verify all .ini files have version 02.01.08
|
||||||
grep -r 'Version:' src/**/*.ini | grep -v '02.01.08'
|
grep -r 'Version:' source/**/*.ini | grep -v '02.01.08'
|
||||||
# Expected: no output
|
# Expected: no output
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/troubleshooting-guide.md
|
PATH: /docs/guides/troubleshooting-guide.md
|
||||||
BRIEF: Troubleshooting guide for diagnosing and resolving issues related to the MokoWaaS plugin
|
BRIEF: Troubleshooting guide for diagnosing and resolving issues related to the MokoWaaS plugin
|
||||||
NOTE: Designed for administrators and WaaS operations teams
|
NOTE: Designed for administrators and WaaS operations teams
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Troubleshooting Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Troubleshooting Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Troubleshooting Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Guides
|
INGROUP: MokoWaaS.Guides
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/guides/upgrade-and-versioning-guide.md
|
PATH: /docs/guides/upgrade-and-versioning-guide.md
|
||||||
BRIEF: Guide for updating, versioning, and maintaining the MokoWaaS plugin
|
BRIEF: Guide for updating, versioning, and maintaining the MokoWaaS plugin
|
||||||
NOTE: Defines release flow, version rules, and upgrade validation
|
NOTE: Defines release flow, version rules, and upgrade validation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Upgrade and Versioning Guide (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Upgrade and Versioning Guide (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Upgrade and Versioning Guide (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -10,13 +10,21 @@
|
|||||||
DEFGROUP: Joomla.Plugin
|
DEFGROUP: Joomla.Plugin
|
||||||
INGROUP: MokoWaaS.Documentation
|
INGROUP: MokoWaaS.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
PATH: /docs/index.md
|
PATH: /docs/index.md
|
||||||
BRIEF: Master index of all documentation for the MokoWaaS plugin
|
BRIEF: Master index of all documentation for the MokoWaaS plugin
|
||||||
NOTE: Automatically maintained index for all guide canvases
|
NOTE: Automatically maintained index for all guide canvases
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Documentation Index (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Documentation Index (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Documentation Index (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -11,12 +11,20 @@
|
|||||||
INGROUP: MokoWaaS
|
INGROUP: MokoWaaS
|
||||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||||
PATH: /docs/plugin-basic.md
|
PATH: /docs/plugin-basic.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
BRIEF: Baseline documentation for the MokoWaaS system plugin
|
BRIEF: Baseline documentation for the MokoWaaS system plugin
|
||||||
NOTE: Foundational reference for internal and external stakeholders
|
NOTE: Foundational reference for internal and external stakeholders
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# MokoWaaS Plugin Overview (VERSION: 02.34.08)
|
<<<<<<< HEAD
|
||||||
|
# MokoWaaS Plugin Overview (VERSION: 02.34.00)
|
||||||
|
=======
|
||||||
|
# MokoWaaS Plugin Overview (VERSION: 02.34.16)
|
||||||
|
>>>>>>> origin/dev
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ DEFGROUP: MokoWaaS.Documentation
|
|||||||
INGROUP: MokoStandards.Templates
|
INGROUP: MokoStandards.Templates
|
||||||
REPO: https://github.com/mokoconsulting-tech/MokoWaaS
|
REPO: https://github.com/mokoconsulting-tech/MokoWaaS
|
||||||
PATH: /docs/update-server.md
|
PATH: /docs/update-server.md
|
||||||
VERSION: 02.34.08
|
<<<<<<< HEAD
|
||||||
|
VERSION: 02.34.00
|
||||||
|
=======
|
||||||
|
VERSION: 02.34.16
|
||||||
|
>>>>>>> origin/dev
|
||||||
BRIEF: How this extension's Joomla update server file (update.xml) is managed
|
BRIEF: How this extension's Joomla update server file (update.xml) is managed
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -84,7 +88,7 @@ Since Joomla sites read `updates.xml` from the `main` branch, the `update-server
|
|||||||
|
|
||||||
### Metadata Source
|
### Metadata Source
|
||||||
|
|
||||||
All metadata is extracted from the extension's XML manifest (`src/*.xml`) at build time:
|
All metadata is extracted from the extension's XML manifest (`source/*.xml`) at build time:
|
||||||
|
|
||||||
| XML Element | Source | Notes |
|
| XML Element | Source | Notes |
|
||||||
|-------------|--------|-------|
|
|-------------|--------|-------|
|
||||||
@@ -136,7 +140,7 @@ The `repo_health.yml` workflow verifies on every commit:
|
|||||||
- `<version>`, `<name>`, `<author>`, `<namespace>` tags present
|
- `<version>`, `<name>`, `<author>`, `<namespace>` tags present
|
||||||
- Extension `type` attribute is valid
|
- Extension `type` attribute is valid
|
||||||
- Language `.ini` files exist
|
- Language `.ini` files exist
|
||||||
- `index.html` directory listing protection in `src/`, `src/admin/`, `src/site/`
|
- `index.html` directory listing protection in `source/`, `source/admin/`, `source/site/`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Extension catalog for MokoWaaS Extension Manager.
|
||||||
|
Each entry points to the extension's own updates.xml — the installer
|
||||||
|
resolves the latest version and download URL at runtime.
|
||||||
|
|
||||||
|
To add an extension: copy an <extension> block and fill in the fields.
|
||||||
|
The updateserver URL must point to a valid Joomla updates.xml file.
|
||||||
|
-->
|
||||||
|
<catalog>
|
||||||
|
<extension>
|
||||||
|
<name>MokoWaaS</name>
|
||||||
|
<element>pkg_mokowaas</element>
|
||||||
|
<type>package</type>
|
||||||
|
<description>Admin dashboard, security firewall, tenant restrictions, health monitoring, and REST API.</description>
|
||||||
|
<icon>icon-shield-alt</icon>
|
||||||
|
<category>Platform</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokowaas-platform</article>
|
||||||
|
<protected>true</protected>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>MokoOnyx</name>
|
||||||
|
<element>mokoonyx</element>
|
||||||
|
<type>template</type>
|
||||||
|
<description>Modern Joomla site template with dark mode, custom layouts, and MokoWaaS integration.</description>
|
||||||
|
<icon>icon-paint-brush</icon>
|
||||||
|
<category>Templates</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokoonyx-template</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>MokoJoomTOS</name>
|
||||||
|
<element>com_mokojoomtos</element>
|
||||||
|
<type>component</type>
|
||||||
|
<description>Terms of Service and privacy policy component with consent tracking.</description>
|
||||||
|
<icon>icon-file-contract</icon>
|
||||||
|
<category>Components</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokojoomtos</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoJoomTOS/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>MokoJoomHero</name>
|
||||||
|
<element>mod_mokojoomhero</element>
|
||||||
|
<type>module</type>
|
||||||
|
<description>Random hero image module from a configurable folder.</description>
|
||||||
|
<icon>icon-image</icon>
|
||||||
|
<category>Modules</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokojoomhero</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoJoomHero/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>MokoWaaS Announce</name>
|
||||||
|
<element>mod_mokowaas_announce</element>
|
||||||
|
<type>module</type>
|
||||||
|
<description>Centralized announcement system via admin module.</description>
|
||||||
|
<icon>icon-bullhorn</icon>
|
||||||
|
<category>Modules</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokowaas-announce</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoWaaSAnnounce/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>DPCalendar API</name>
|
||||||
|
<element>mokodpcalendarapi</element>
|
||||||
|
<type>plugin</type>
|
||||||
|
<description>Web Services plugin exposing DPCalendar events and calendars via REST API.</description>
|
||||||
|
<icon>icon-calendar</icon>
|
||||||
|
<category>Plugins</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokodpcalendarapi</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoDPCalendarAPI/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>Gallery Calendar</name>
|
||||||
|
<element>mokogallerycalendar</element>
|
||||||
|
<type>plugin</type>
|
||||||
|
<description>JoomGallery and DPCalendar integration — link galleries to events.</description>
|
||||||
|
<icon>icon-images</icon>
|
||||||
|
<category>Plugins</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokogallerycalendar</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoGalleryCalendar/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<name>MokoJoomOpenGraph</name>
|
||||||
|
<element>pkg_mokoog</element>
|
||||||
|
<type>package</type>
|
||||||
|
<description>Open Graph, Twitter Card, and social sharing meta tags for articles, categories, and pages.</description>
|
||||||
|
<icon>icon-share-alt</icon>
|
||||||
|
<category>Components</category>
|
||||||
|
<article>https://mokoconsulting.tech/support/products/mokojoomopengraph</article>
|
||||||
|
<updateserver>https://git.mokoconsulting.tech/MokoConsulting/MokoJoomOpenGraph/raw/branch/dev/updates.xml</updateserver>
|
||||||
|
</extension>
|
||||||
|
</catalog>
|
||||||
+13
@@ -96,6 +96,19 @@ class DisplayController extends BaseController
|
|||||||
$this->jsonResponse($this->getModel('Dashboard')->clearCache());
|
$this->jsonResponse($this->getModel('Dashboard')->clearCache());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clearTemp()
|
||||||
|
{
|
||||||
|
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
if (!$this->checkAcl('mokowaas.cache'))
|
||||||
|
{
|
||||||
|
$this->jsonForbidden();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->jsonResponse($this->getModel('Dashboard')->clearTemp());
|
||||||
|
}
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
// Extensions
|
// Extensions
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
+106
-2
@@ -24,8 +24,8 @@ class DashboardModel extends BaseDatabaseModel
|
|||||||
'mokowaas' => [
|
'mokowaas' => [
|
||||||
'icon' => 'icon-shield-alt',
|
'icon' => 'icon-shield-alt',
|
||||||
'category' => 'core',
|
'category' => 'core',
|
||||||
'label' => 'Core — Branding & Identity',
|
'label' => 'Core',
|
||||||
'description' => 'White-label branding, master user enforcement, emergency access, and plugin protection.',
|
'description' => 'Heartbeat, health monitoring, site aliases, extension coordination, and download key preservation.',
|
||||||
'protected' => true,
|
'protected' => true,
|
||||||
'configure_only' => false,
|
'configure_only' => false,
|
||||||
],
|
],
|
||||||
@@ -212,6 +212,54 @@ class DashboardModel extends BaseDatabaseModel
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get installed MokoWaaS component and modules with versions.
|
||||||
|
*
|
||||||
|
* @return array Array of extension objects with name, element, type, version.
|
||||||
|
*/
|
||||||
|
public function getMokoExtensions(): array
|
||||||
|
{
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select([
|
||||||
|
$db->quoteName('element'),
|
||||||
|
$db->quoteName('name'),
|
||||||
|
$db->quoteName('type'),
|
||||||
|
$db->quoteName('enabled'),
|
||||||
|
$db->quoteName('manifest_cache'),
|
||||||
|
])
|
||||||
|
->from($db->quoteName('#__extensions'))
|
||||||
|
->where('('
|
||||||
|
// The component
|
||||||
|
. '(' . $db->quoteName('type') . ' = ' . $db->quote('component')
|
||||||
|
. ' AND ' . $db->quoteName('element') . ' = ' . $db->quote('com_mokowaas') . ')'
|
||||||
|
// Admin modules
|
||||||
|
. ' OR (' . $db->quoteName('type') . ' = ' . $db->quote('module')
|
||||||
|
. ' AND ' . $db->quoteName('element') . ' LIKE ' . $db->quote('mod_mokowaas%') . ')'
|
||||||
|
. ')')
|
||||||
|
->order($db->quoteName('type') . ' ASC, ' . $db->quoteName('element') . ' ASC');
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$rows = $db->loadObjectList() ?: [];
|
||||||
|
|
||||||
|
$extensions = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$manifest = json_decode($row->manifest_cache ?? '{}');
|
||||||
|
|
||||||
|
$extensions[] = (object) [
|
||||||
|
'element' => $row->element,
|
||||||
|
'name' => $manifest->name ?? $row->name,
|
||||||
|
'type' => $row->type,
|
||||||
|
'version' => $manifest->version ?? '',
|
||||||
|
'enabled' => (int) $row->enabled,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $extensions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle a plugin's enabled state.
|
* Toggle a plugin's enabled state.
|
||||||
*
|
*
|
||||||
@@ -294,6 +342,62 @@ class DashboardModel extends BaseDatabaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the Joomla tmp directory.
|
||||||
|
*
|
||||||
|
* Removes all files and subdirectories from the configured tmp_path,
|
||||||
|
* preserving the directory itself and any .htaccess / web.config files.
|
||||||
|
*
|
||||||
|
* @return array Result with success and message keys.
|
||||||
|
*/
|
||||||
|
public function clearTemp(): array
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$tmpPath = Factory::getApplication()->get('tmp_path', JPATH_ROOT . '/tmp');
|
||||||
|
|
||||||
|
if (!is_dir($tmpPath))
|
||||||
|
{
|
||||||
|
return ['success' => false, 'message' => 'Temp directory does not exist: ' . $tmpPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
$protected = ['.htaccess', 'web.config', 'index.html', '.gitkeep'];
|
||||||
|
|
||||||
|
$items = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveDirectoryIterator($tmpPath, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
|
\RecursiveIteratorIterator::CHILD_FIRST
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($items as $item)
|
||||||
|
{
|
||||||
|
$basename = $item->getBasename();
|
||||||
|
|
||||||
|
// Skip protected files in the root tmp directory
|
||||||
|
if ($item->getPath() === $tmpPath && \in_array($basename, $protected, true))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item->isDir())
|
||||||
|
{
|
||||||
|
@rmdir($item->getPathname());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@unlink($item->getPathname());
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['success' => true, 'message' => sprintf('Temp directory cleaned (%d files removed).', $count)];
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
return ['success' => false, 'message' => 'Temp clear failed: ' . $e->getMessage()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-generate dashboard metadata for plugins not in the static map.
|
* Auto-generate dashboard metadata for plugins not in the static map.
|
||||||
*/
|
*/
|
||||||
@@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package MokoWaaS
|
||||||
|
* @subpackage com_mokowaas
|
||||||
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GNU General Public License version 3 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Moko\Component\MokoWaaS\Administrator\Model;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension catalog model — reads catalog.xml, fetches each extension's
|
||||||
|
* updates.xml to resolve latest version and download URL, and checks
|
||||||
|
* local install status.
|
||||||
|
*
|
||||||
|
* @since 02.32.00
|
||||||
|
*/
|
||||||
|
class ExtensionsModel extends BaseDatabaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parsed catalog entries (cached per request).
|
||||||
|
*
|
||||||
|
* @var array|null
|
||||||
|
*/
|
||||||
|
private ?array $catalogCache = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full catalog with install status and release info.
|
||||||
|
*
|
||||||
|
* @return array Array of catalog entry objects
|
||||||
|
*/
|
||||||
|
public function getCatalog(): array
|
||||||
|
{
|
||||||
|
$catalog = $this->loadCatalog();
|
||||||
|
$installed = $this->getInstalledVersions($catalog);
|
||||||
|
$packages = [];
|
||||||
|
|
||||||
|
foreach ($catalog as $entry)
|
||||||
|
{
|
||||||
|
$release = $this->fetchFromUpdateServer($entry['updateserver'] ?? '');
|
||||||
|
|
||||||
|
$localVersion = $installed[$entry['element']] ?? null;
|
||||||
|
$remoteVersion = $release['version'] ?? '';
|
||||||
|
$downloadUrl = $release['download_url'] ?? '';
|
||||||
|
|
||||||
|
$status = 'not_installed';
|
||||||
|
|
||||||
|
if ($localVersion !== null)
|
||||||
|
{
|
||||||
|
$status = 'installed';
|
||||||
|
|
||||||
|
if ($remoteVersion !== '' && version_compare($remoteVersion, $localVersion, '>'))
|
||||||
|
{
|
||||||
|
$status = 'update_available';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$extensionId = $this->getExtensionId($entry['element']);
|
||||||
|
|
||||||
|
$packages[] = (object) [
|
||||||
|
'label' => $entry['name'],
|
||||||
|
'description' => $entry['description'],
|
||||||
|
'element' => $entry['element'],
|
||||||
|
'type' => $entry['type'],
|
||||||
|
'icon' => $entry['icon'],
|
||||||
|
'category' => $entry['category'],
|
||||||
|
'local_version' => $localVersion ?? '',
|
||||||
|
'remote_version' => $remoteVersion,
|
||||||
|
'download_url' => $downloadUrl,
|
||||||
|
'status' => $status,
|
||||||
|
'article_url' => $entry['article'] ?? '',
|
||||||
|
'protected' => ($entry['protected'] ?? 'false') === 'true',
|
||||||
|
'extension_id' => $extensionId,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install an extension from a remote ZIP URL.
|
||||||
|
*
|
||||||
|
* @param string $url The download URL
|
||||||
|
*
|
||||||
|
* @return array Result with success, message, and extension info
|
||||||
|
*/
|
||||||
|
public function installFromUrl(string $url): array
|
||||||
|
{
|
||||||
|
$tmpPath = Factory::getConfig()->get('tmp_path', JPATH_ROOT . '/tmp');
|
||||||
|
$tmpFile = $tmpPath . '/mokowaas_install_' . md5($url) . '.zip';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
$data = curl_exec($ch);
|
||||||
|
$code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$error = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($error || $code !== 200 || empty($data))
|
||||||
|
{
|
||||||
|
return ['success' => false, 'message' => 'Download failed: ' . ($error ?: "HTTP {$code}")];
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($tmpFile, $data);
|
||||||
|
|
||||||
|
$installer = new \Joomla\CMS\Installer\Installer();
|
||||||
|
$result = $installer->install($tmpFile);
|
||||||
|
|
||||||
|
@unlink($tmpFile);
|
||||||
|
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
return ['success' => false, 'message' => 'Installation failed.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Installed successfully.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
@unlink($tmpFile);
|
||||||
|
|
||||||
|
return ['success' => false, 'message' => 'Error: ' . $e->getMessage()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load and parse the catalog.xml file.
|
||||||
|
*
|
||||||
|
* @return array Array of associative arrays, one per extension
|
||||||
|
*/
|
||||||
|
private function loadCatalog(): array
|
||||||
|
{
|
||||||
|
if ($this->catalogCache !== null)
|
||||||
|
{
|
||||||
|
return $this->catalogCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
$catalogFile = JPATH_ADMINISTRATOR . '/components/com_mokowaas/catalog.xml';
|
||||||
|
|
||||||
|
if (!file_exists($catalogFile))
|
||||||
|
{
|
||||||
|
$this->catalogCache = [];
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = @simplexml_load_file($catalogFile);
|
||||||
|
|
||||||
|
if (!$xml)
|
||||||
|
{
|
||||||
|
$this->catalogCache = [];
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$entries = [];
|
||||||
|
|
||||||
|
foreach ($xml->extension as $ext)
|
||||||
|
{
|
||||||
|
$entries[] = [
|
||||||
|
'name' => (string) $ext->name,
|
||||||
|
'element' => (string) $ext->element,
|
||||||
|
'type' => (string) $ext->type,
|
||||||
|
'description' => (string) $ext->description,
|
||||||
|
'icon' => (string) $ext->icon,
|
||||||
|
'category' => (string) $ext->category,
|
||||||
|
'article' => (string) $ext->article,
|
||||||
|
'protected' => (string) $ext->protected,
|
||||||
|
'updateserver' => (string) $ext->updateserver,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->catalogCache = $entries;
|
||||||
|
|
||||||
|
return $entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the latest version and download URL from an extension's updates.xml.
|
||||||
|
*
|
||||||
|
* Parses the standard Joomla update server XML format and returns
|
||||||
|
* the highest version entry with its download URL.
|
||||||
|
*
|
||||||
|
* @param string $updateServerUrl URL to the updates.xml file
|
||||||
|
*
|
||||||
|
* @return array [version, download_url] or empty array
|
||||||
|
*/
|
||||||
|
private function fetchFromUpdateServer(string $updateServerUrl): array
|
||||||
|
{
|
||||||
|
if (empty($updateServerUrl))
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init($updateServerUrl);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($code !== 200 || empty($response))
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = @simplexml_load_string($response);
|
||||||
|
|
||||||
|
if (!$xml)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the highest version entry
|
||||||
|
$bestVersion = '0.0.0';
|
||||||
|
$downloadUrl = '';
|
||||||
|
|
||||||
|
foreach ($xml->update as $update)
|
||||||
|
{
|
||||||
|
$ver = (string) ($update->version ?? '');
|
||||||
|
|
||||||
|
if ($ver === '' || version_compare($ver, $bestVersion, '<='))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bestVersion = $ver;
|
||||||
|
|
||||||
|
// Get download URL from <downloads><downloadurl>
|
||||||
|
if (isset($update->downloads->downloadurl))
|
||||||
|
{
|
||||||
|
$downloadUrl = (string) $update->downloads->downloadurl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bestVersion === '0.0.0')
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'version' => $bestVersion,
|
||||||
|
'download_url' => $downloadUrl,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get installed versions of catalog extensions.
|
||||||
|
*
|
||||||
|
* @param array $catalog The parsed catalog entries
|
||||||
|
*
|
||||||
|
* @return array element => version
|
||||||
|
*/
|
||||||
|
private function getInstalledVersions(array $catalog): array
|
||||||
|
{
|
||||||
|
if (empty($catalog))
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
$elements = [];
|
||||||
|
|
||||||
|
foreach ($catalog as $entry)
|
||||||
|
{
|
||||||
|
$elements[] = $db->quote($entry['element']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select([$db->quoteName('element'), $db->quoteName('manifest_cache')])
|
||||||
|
->from($db->quoteName('#__extensions'))
|
||||||
|
->where($db->quoteName('element') . ' IN (' . implode(',', $elements) . ')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$rows = $db->loadObjectList() ?: [];
|
||||||
|
|
||||||
|
$versions = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$mc = json_decode($row->manifest_cache ?? '{}');
|
||||||
|
$versions[$row->element] = $mc->version ?? '0.0.0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $versions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the extension_id for an element (for uninstall links).
|
||||||
|
*
|
||||||
|
* @param string $element Extension element name
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private function getExtensionId(string $element): int
|
||||||
|
{
|
||||||
|
$db = $this->getDatabase();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('extension_id'))
|
||||||
|
->from($db->quoteName('#__extensions'))
|
||||||
|
->where($db->quoteName('element') . ' = ' . $db->quote($element))
|
||||||
|
->setLimit(1);
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
return (int) $db->loadResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -25,6 +25,7 @@ class HtmlView extends BaseHtmlView
|
|||||||
protected $wafBlocks = [];
|
protected $wafBlocks = [];
|
||||||
protected $wafChartData = [];
|
protected $wafChartData = [];
|
||||||
protected $loginChartData = [];
|
protected $loginChartData = [];
|
||||||
|
protected $mokoExtensions = [];
|
||||||
|
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,7 @@ class HtmlView extends BaseHtmlView
|
|||||||
$this->wafBlocks = $model->getRecentWafBlocks(5);
|
$this->wafBlocks = $model->getRecentWafBlocks(5);
|
||||||
$this->wafChartData = $model->getWafBlocksByDay(14);
|
$this->wafChartData = $model->getWafBlocksByDay(14);
|
||||||
$this->loginChartData = $model->getLoginsByDay(14);
|
$this->loginChartData = $model->getLoginsByDay(14);
|
||||||
|
$this->mokoExtensions = $model->getMokoExtensions();
|
||||||
|
|
||||||
// Check for importable Akeeba data
|
// Check for importable Akeeba data
|
||||||
try
|
try
|
||||||
+26
@@ -19,6 +19,7 @@ $siteInfo = $this->siteInfo;
|
|||||||
$plugins = $this->plugins;
|
$plugins = $this->plugins;
|
||||||
$recentLogins = $this->recentLogins;
|
$recentLogins = $this->recentLogins;
|
||||||
$pendingUpdates = $this->pendingUpdates;
|
$pendingUpdates = $this->pendingUpdates;
|
||||||
|
$mokoExts = $this->mokoExtensions;
|
||||||
$adminToolsAvail = $this->adminToolsAvailable ?? null;
|
$adminToolsAvail = $this->adminToolsAvailable ?? null;
|
||||||
$atsAvail = $this->atsAvailable ?? null;
|
$atsAvail = $this->atsAvailable ?? null;
|
||||||
$checkedOut = $this->checkedOutItems;
|
$checkedOut = $this->checkedOutItems;
|
||||||
@@ -72,6 +73,31 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($mokoExts)): ?>
|
||||||
|
<!-- Moko Component & Module Versions -->
|
||||||
|
<div class="d-flex flex-wrap gap-2 mb-4">
|
||||||
|
<?php
|
||||||
|
$extIcons = [
|
||||||
|
'com_mokowaas' => 'icon-cogs',
|
||||||
|
'mod_mokowaas_cpanel' => 'icon-tachometer-alt',
|
||||||
|
'mod_mokowaas_menu' => 'icon-bars',
|
||||||
|
'mod_mokowaas_cache' => 'icon-bolt',
|
||||||
|
'mod_mokowaas_categories' => 'icon-folder',
|
||||||
|
];
|
||||||
|
foreach ($mokoExts as $ext):
|
||||||
|
$icon = $extIcons[$ext->element] ?? 'icon-puzzle-piece';
|
||||||
|
$label = str_replace(['mod_mokowaas_', 'com_mokowaas'], ['', 'Component'], $ext->element);
|
||||||
|
$label = ucfirst($label ?: 'Component');
|
||||||
|
?>
|
||||||
|
<div class="d-flex align-items-center gap-2 px-3 py-2 rounded border bg-white" style="font-size:0.85rem;">
|
||||||
|
<span class="<?php echo $icon; ?>" aria-hidden="true" style="color:#1a2744;"></span>
|
||||||
|
<span><?php echo $this->escape($label); ?></span>
|
||||||
|
<span class="badge bg-light text-dark"><?php echo $this->escape($ext->version); ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($adminToolsAvail || $atsAvail): ?>
|
<?php if ($adminToolsAvail || $atsAvail): ?>
|
||||||
<!-- Akeeba Import Banner -->
|
<!-- Akeeba Import Banner -->
|
||||||
<div class="alert alert-info d-flex flex-wrap align-items-center gap-3 mb-4">
|
<div class="alert alert-info d-flex flex-wrap align-items-center gap-3 mb-4">
|
||||||
+16
-3
@@ -25,8 +25,9 @@ foreach ($packages as $pkg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$statusBadge = [
|
$statusBadge = [
|
||||||
'installed' => ['bg-success', 'Installed'],
|
'installed' => ['bg-success', 'Installed'],
|
||||||
'not_installed' => ['bg-secondary', 'Not Installed'],
|
'update_available' => ['bg-warning text-dark', 'Update Available'],
|
||||||
|
'not_installed' => ['bg-secondary', 'Not Installed'],
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -63,6 +64,9 @@ $statusBadge = [
|
|||||||
<div class="small text-muted">
|
<div class="small text-muted">
|
||||||
<?php if ($pkg->local_version): ?>
|
<?php if ($pkg->local_version): ?>
|
||||||
v<?php echo htmlspecialchars($pkg->local_version); ?>
|
v<?php echo htmlspecialchars($pkg->local_version); ?>
|
||||||
|
<?php if ($pkg->remote_version && $pkg->status === 'update_available'): ?>
|
||||||
|
→ <?php echo htmlspecialchars($pkg->remote_version); ?>
|
||||||
|
<?php endif; ?>
|
||||||
<?php elseif ($pkg->remote_version): ?>
|
<?php elseif ($pkg->remote_version): ?>
|
||||||
Latest: <?php echo htmlspecialchars($pkg->remote_version); ?>
|
Latest: <?php echo htmlspecialchars($pkg->remote_version); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -73,7 +77,16 @@ $statusBadge = [
|
|||||||
<span class="icon-book" aria-hidden="true"></span>
|
<span class="icon-book" aria-hidden="true"></span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($pkg->download_url && $pkg->status === 'not_installed'): ?>
|
<?php if ($pkg->download_url && $pkg->status === 'update_available'): ?>
|
||||||
|
<button type="button" class="btn btn-sm btn-warning mokowaas-install-btn"
|
||||||
|
data-url="<?php echo Route::_('index.php?option=com_mokowaas&task=display.installExtension&format=json'); ?>"
|
||||||
|
data-download="<?php echo htmlspecialchars($pkg->download_url); ?>"
|
||||||
|
data-token="<?php echo $token; ?>"
|
||||||
|
data-label="<?php echo htmlspecialchars($pkg->label); ?>">
|
||||||
|
<span class="icon-refresh" aria-hidden="true"></span>
|
||||||
|
Update to <?php echo htmlspecialchars($pkg->remote_version); ?>
|
||||||
|
</button>
|
||||||
|
<?php elseif ($pkg->download_url && $pkg->status === 'not_installed'): ?>
|
||||||
<button type="button" class="btn btn-sm btn-primary mokowaas-install-btn"
|
<button type="button" class="btn btn-sm btn-primary mokowaas-install-btn"
|
||||||
data-url="<?php echo Route::_('index.php?option=com_mokowaas&task=display.installExtension&format=json'); ?>"
|
data-url="<?php echo Route::_('index.php?option=com_mokowaas&task=display.installExtension&format=json'); ?>"
|
||||||
data-download="<?php echo htmlspecialchars($pkg->download_url); ?>"
|
data-download="<?php echo htmlspecialchars($pkg->download_url); ?>"
|
||||||
+1
-1
@@ -29,7 +29,7 @@ class CacheController extends BaseController
|
|||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'cache'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
+1
-1
@@ -42,7 +42,7 @@ class InstallController extends BaseController
|
|||||||
*
|
*
|
||||||
* @since 02.21.00
|
* @since 02.21.00
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'install'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
+1
-1
@@ -104,7 +104,7 @@ class PluginsController extends BaseController
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'plugins'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$user = $app->getIdentity();
|
$user = $app->getIdentity();
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package MokoWaaS
|
||||||
|
* @subpackage com_mokowaas
|
||||||
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GNU General Public License version 3 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Moko\Component\MokoWaaS\Api\Controller;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\MVC\Controller\BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provision reset API controller.
|
||||||
|
*
|
||||||
|
* POST /api/index.php/v1/mokowaas/provision-reset
|
||||||
|
*
|
||||||
|
* Resets a site for new client provisioning: clears hits, versions,
|
||||||
|
* download keys, and flags the site for fresh client info collection.
|
||||||
|
* Used after copying a demo site to create a new client install.
|
||||||
|
*
|
||||||
|
* @since 02.35.00
|
||||||
|
*/
|
||||||
|
class ProvisionController extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Reset the site for new client provisioning.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function execute($task = 'provision'): void
|
||||||
|
{
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
$user = $app->getIdentity();
|
||||||
|
|
||||||
|
if (!$user->authorise('core.manage', 'com_mokowaas'))
|
||||||
|
{
|
||||||
|
$this->sendJson(403, ['error' => 'Not authorized']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($app->input->getMethod() !== 'POST')
|
||||||
|
{
|
||||||
|
$this->sendJson(405, ['error' => 'POST required']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$results = [];
|
||||||
|
|
||||||
|
// 1. Reset article hit counters
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__content'))
|
||||||
|
->set($db->quoteName('hits') . ' = 0')
|
||||||
|
)->execute();
|
||||||
|
$results['hits_reset'] = $db->getAffectedRows();
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
$results['hits_reset'] = 'error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Delete content version history
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)->delete($db->quoteName('#__history'))
|
||||||
|
)->execute();
|
||||||
|
$results['versions_deleted'] = $db->getAffectedRows();
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
$results['versions_deleted'] = 'error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Regenerate heartbeat token if requested
|
||||||
|
$input = $app->getInput()->json;
|
||||||
|
$resetToken = (bool) ($input->get('reset_token', false, 'BOOLEAN'));
|
||||||
|
|
||||||
|
if ($resetToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$newToken = bin2hex(random_bytes(32));
|
||||||
|
|
||||||
|
$plugin = \Joomla\CMS\Plugin\PluginHelper::getPlugin('system', 'mokowaas');
|
||||||
|
|
||||||
|
if ($plugin)
|
||||||
|
{
|
||||||
|
$pluginParams = new \Joomla\Registry\Registry($plugin->params);
|
||||||
|
$pluginParams->set('health_api_token', $newToken);
|
||||||
|
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)
|
||||||
|
->update($db->quoteName('#__extensions'))
|
||||||
|
->set($db->quoteName('params') . ' = ' . $db->quote($pluginParams->toString()))
|
||||||
|
->where($db->quoteName('element') . ' = ' . $db->quote('mokowaas'))
|
||||||
|
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||||
|
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$results['token_regenerated'] = true;
|
||||||
|
$results['new_token'] = $newToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
$results['token_regenerated'] = 'error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Reset all user API tokens if requested
|
||||||
|
$resetApiTokens = (bool) ($input->get('reset_api_tokens', false, 'BOOLEAN'));
|
||||||
|
|
||||||
|
if ($resetApiTokens)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get users who have API tokens before deleting
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)
|
||||||
|
->select('DISTINCT ' . $db->quoteName('user_id'))
|
||||||
|
->from($db->quoteName('#__user_keys'))
|
||||||
|
->where($db->quoteName('series') . ' LIKE ' . $db->quote('api-%'))
|
||||||
|
);
|
||||||
|
$affectedUserIds = $db->loadColumn() ?: [];
|
||||||
|
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)->delete($db->quoteName('#__user_keys'))
|
||||||
|
->where($db->quoteName('series') . ' LIKE ' . $db->quote('api-%'))
|
||||||
|
)->execute();
|
||||||
|
$results['api_tokens_revoked'] = $db->getAffectedRows();
|
||||||
|
|
||||||
|
// Notify affected users
|
||||||
|
if (!empty($affectedUserIds))
|
||||||
|
{
|
||||||
|
$this->notifyTokenReset($db, $affectedUserIds);
|
||||||
|
$results['users_notified'] = \count($affectedUserIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
$results['api_tokens_revoked'] = 'error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Flag site for fresh client info setup
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Write a flag file that the core plugin checks on next admin load
|
||||||
|
$flagFile = JPATH_ADMINISTRATOR . '/cache/mokowaas_setup_required.flag';
|
||||||
|
file_put_contents($flagFile, json_encode([
|
||||||
|
'created' => gmdate('Y-m-d\TH:i:s\Z'),
|
||||||
|
'reason' => 'provision-reset',
|
||||||
|
'remote_ip' => $_SERVER['REMOTE_ADDR'] ?? '',
|
||||||
|
]));
|
||||||
|
$results['setup_flag'] = true;
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
$results['setup_flag'] = 'error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sendJson(200, [
|
||||||
|
'status' => 'ok',
|
||||||
|
'message' => 'Site provisioned for new client.',
|
||||||
|
'results' => $results,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify users that their API tokens have been revoked.
|
||||||
|
*/
|
||||||
|
private function notifyTokenReset($db, array $userIds): void
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)
|
||||||
|
->select([$db->quoteName('name'), $db->quoteName('email')])
|
||||||
|
->from($db->quoteName('#__users'))
|
||||||
|
->whereIn($db->quoteName('id'), $userIds)
|
||||||
|
->where($db->quoteName('block') . ' = 0')
|
||||||
|
);
|
||||||
|
$users = $db->loadObjectList() ?: [];
|
||||||
|
|
||||||
|
$config = Factory::getConfig();
|
||||||
|
$siteName = $config->get('sitename', 'Joomla');
|
||||||
|
$siteUrl = rtrim(\Joomla\CMS\Uri\Uri::root(), '/');
|
||||||
|
|
||||||
|
$mailer = Factory::getMailer();
|
||||||
|
|
||||||
|
foreach ($users as $u)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$mailer->clearAllRecipients();
|
||||||
|
$mailer->addRecipient($u->email, $u->name);
|
||||||
|
$mailer->setSubject($siteName . ' — API tokens have been reset');
|
||||||
|
$mailer->setBody(
|
||||||
|
"Hello {$u->name},\n\n"
|
||||||
|
. "Your API access tokens on {$siteName} have been revoked by an administrator.\n\n"
|
||||||
|
. "If you use API integrations, please log in and generate a new token:\n"
|
||||||
|
. "{$siteUrl}/administrator/\n\n"
|
||||||
|
. "— {$siteName}"
|
||||||
|
);
|
||||||
|
$mailer->send();
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
// Non-critical
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Throwable $e)
|
||||||
|
{
|
||||||
|
// Non-critical
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sendJson(int $code, array $data): void
|
||||||
|
{
|
||||||
|
http_response_code($code);
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($data, JSON_UNESCAPED_SLASHES);
|
||||||
|
Factory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package MokoWaaS
|
||||||
|
* @subpackage com_mokowaas
|
||||||
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
|
* @license GNU General Public License version 3 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Moko\Component\MokoWaaS\Api\Controller;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\MVC\Controller\BaseController;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remote login API controller.
|
||||||
|
*
|
||||||
|
* POST /api/index.php/v1/mokowaas/remote-login
|
||||||
|
* Body: {"token": "health_api_token", "user": "requesting_username", "origin": "MokoWaaSBase"}
|
||||||
|
*
|
||||||
|
* Validates the health API token, generates a one-time login token
|
||||||
|
* for the master user, and returns a URL that auto-authenticates.
|
||||||
|
*
|
||||||
|
* @since 02.35.00
|
||||||
|
*/
|
||||||
|
class RemoteLoginController extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* One-time token validity in seconds.
|
||||||
|
*/
|
||||||
|
private const OTL_TTL = 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a one-time login URL for the master user.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function execute($task = 'remoteLogin'): void
|
||||||
|
{
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
$input = $app->getInput()->json;
|
||||||
|
|
||||||
|
$token = $input->get('token', '', 'RAW');
|
||||||
|
$origin = $input->get('origin', '', 'STRING');
|
||||||
|
|
||||||
|
if (empty($token))
|
||||||
|
{
|
||||||
|
$this->sendJson(401, ['error' => 'Missing token']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate against the core plugin's health_api_token
|
||||||
|
$plugin = PluginHelper::getPlugin('system', 'mokowaas');
|
||||||
|
|
||||||
|
if (!$plugin)
|
||||||
|
{
|
||||||
|
$this->sendJson(503, ['error' => 'MokoWaaS core plugin not found']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = new Registry($plugin->params);
|
||||||
|
$healthToken = $params->get('health_api_token', '');
|
||||||
|
|
||||||
|
if (empty($healthToken) || !hash_equals($healthToken, $token))
|
||||||
|
{
|
||||||
|
$this->sendJson(401, ['error' => 'Invalid token']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the master user
|
||||||
|
$masterUsernames = $this->getMasterUsernames($params);
|
||||||
|
|
||||||
|
if (empty($masterUsernames))
|
||||||
|
{
|
||||||
|
$this->sendJson(403, ['error' => 'No master user configured']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the first master username
|
||||||
|
$masterUsername = $masterUsernames[0];
|
||||||
|
|
||||||
|
// Look up the user
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$db->setQuery(
|
||||||
|
$db->getQuery(true)
|
||||||
|
->select([$db->quoteName('id'), $db->quoteName('username')])
|
||||||
|
->from($db->quoteName('#__users'))
|
||||||
|
->where($db->quoteName('username') . ' = ' . $db->quote($masterUsername))
|
||||||
|
->where($db->quoteName('block') . ' = 0')
|
||||||
|
);
|
||||||
|
$user = $db->loadObject();
|
||||||
|
|
||||||
|
if (!$user)
|
||||||
|
{
|
||||||
|
$this->sendJson(403, ['error' => 'Master user not found or blocked']);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate one-time login token
|
||||||
|
$otlToken = bin2hex(random_bytes(32));
|
||||||
|
$expires = time() + self::OTL_TTL;
|
||||||
|
|
||||||
|
// Store in a temp file (avoids DB schema changes)
|
||||||
|
$otlFile = JPATH_ADMINISTRATOR . '/cache/mokowaas_otl_' . md5($otlToken) . '.json';
|
||||||
|
file_put_contents($otlFile, json_encode([
|
||||||
|
'token' => $otlToken,
|
||||||
|
'user_id' => (int) $user->id,
|
||||||
|
'username' => $user->username,
|
||||||
|
'expires' => $expires,
|
||||||
|
'origin' => substr($origin, 0, 100),
|
||||||
|
]));
|
||||||
|
|
||||||
|
// Build login URL
|
||||||
|
$loginUrl = rtrim(Uri::root(), '/') . '/administrator/index.php?mokowaas_otl=' . $otlToken;
|
||||||
|
|
||||||
|
$this->sendJson(200, [
|
||||||
|
'status' => 'ok',
|
||||||
|
'login_url' => $loginUrl,
|
||||||
|
'expires' => $expires,
|
||||||
|
'user' => $user->username,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode master usernames from plugin params.
|
||||||
|
*
|
||||||
|
* @param Registry $params Plugin params.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getMasterUsernames(Registry $params): array
|
||||||
|
{
|
||||||
|
// Use MokoWaaSHelper if available
|
||||||
|
$helperFile = JPATH_PLUGINS . '/system/mokowaas/Helper/MokoWaaSHelper.php';
|
||||||
|
|
||||||
|
if (file_exists($helperFile))
|
||||||
|
{
|
||||||
|
require_once $helperFile;
|
||||||
|
|
||||||
|
if (method_exists(\Moko\Plugin\System\MokoWaaS\Helper\MokoWaaSHelper::class, 'getMasterUsernames'))
|
||||||
|
{
|
||||||
|
return \Moko\Plugin\System\MokoWaaS\Helper\MokoWaaSHelper::getMasterUsernames();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send JSON response and terminate.
|
||||||
|
*
|
||||||
|
* @param int $code HTTP status code.
|
||||||
|
* @param array $data Response data.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function sendJson(int $code, array $data): void
|
||||||
|
{
|
||||||
|
http_response_code($code);
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($data, JSON_UNESCAPED_SLASHES);
|
||||||
|
Factory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-4
@@ -35,7 +35,7 @@ class ResetController extends BaseController
|
|||||||
*
|
*
|
||||||
* @since 02.21.00
|
* @since 02.21.00
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'reset'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
@@ -90,18 +90,18 @@ class ResetController extends BaseController
|
|||||||
*/
|
*/
|
||||||
private function createService(Registry $params)
|
private function createService(Registry $params)
|
||||||
{
|
{
|
||||||
$serviceFile = JPATH_PLUGINS . '/system/mokowaas/Service/DemoResetService.php';
|
$serviceFile = JPATH_PLUGINS . '/task/mokowaasdemo/src/Service/DemoResetService.php';
|
||||||
|
|
||||||
if (!file_exists($serviceFile))
|
if (!file_exists($serviceFile))
|
||||||
{
|
{
|
||||||
throw new \RuntimeException('DemoResetService not found — is the MokoWaaS plugin installed?');
|
throw new \RuntimeException('DemoResetService not found — is the demo reset plugin installed?');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $serviceFile;
|
require_once $serviceFile;
|
||||||
|
|
||||||
$media = (bool) $params->get('demo_snapshot_include_media', 1);
|
$media = (bool) $params->get('demo_snapshot_include_media', 1);
|
||||||
|
|
||||||
return new \Moko\Plugin\System\MokoWaaS\Service\DemoResetService($media);
|
return new \Moko\Plugin\Task\MokoWaaSDemo\Service\DemoResetService($media);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+4
-4
@@ -68,7 +68,7 @@ class SnapshotController extends BaseController
|
|||||||
*
|
*
|
||||||
* @since 02.21.00
|
* @since 02.21.00
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'snapshot'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
@@ -118,11 +118,11 @@ class SnapshotController extends BaseController
|
|||||||
*/
|
*/
|
||||||
private function createService()
|
private function createService()
|
||||||
{
|
{
|
||||||
$serviceFile = JPATH_PLUGINS . '/system/mokowaas/Service/DemoResetService.php';
|
$serviceFile = JPATH_PLUGINS . '/task/mokowaasdemo/src/Service/DemoResetService.php';
|
||||||
|
|
||||||
if (!file_exists($serviceFile))
|
if (!file_exists($serviceFile))
|
||||||
{
|
{
|
||||||
throw new \RuntimeException('DemoResetService not found');
|
throw new \RuntimeException('DemoResetService not found — is the demo reset plugin installed?');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $serviceFile;
|
require_once $serviceFile;
|
||||||
@@ -132,7 +132,7 @@ class SnapshotController extends BaseController
|
|||||||
|
|
||||||
$media = (bool) $params->get('demo_snapshot_include_media', 1);
|
$media = (bool) $params->get('demo_snapshot_include_media', 1);
|
||||||
|
|
||||||
return new \Moko\Plugin\System\MokoWaaS\Service\DemoResetService($media);
|
return new \Moko\Plugin\Task\MokoWaaSDemo\Service\DemoResetService($media);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+3
-3
@@ -26,7 +26,7 @@ use Joomla\Registry\Registry;
|
|||||||
*/
|
*/
|
||||||
class SyncController extends BaseController
|
class SyncController extends BaseController
|
||||||
{
|
{
|
||||||
public function execute(): void
|
public function execute($task = 'sync'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ class SyncController extends BaseController
|
|||||||
$params = new Registry($plugin->params);
|
$params = new Registry($plugin->params);
|
||||||
$targets = json_decode($params->get('sync_targets', '[]'), true) ?: [];
|
$targets = json_decode($params->get('sync_targets', '[]'), true) ?: [];
|
||||||
|
|
||||||
$serviceFile = JPATH_PLUGINS . '/system/mokowaas/Service/ContentSyncService.php';
|
$serviceFile = JPATH_PLUGINS . '/task/mokowaassync/src/Service/ContentSyncService.php';
|
||||||
require_once $serviceFile;
|
require_once $serviceFile;
|
||||||
|
|
||||||
$service = new \Moko\Plugin\System\MokoWaaS\Service\ContentSyncService();
|
$service = new \Moko\Plugin\Task\MokoWaaSSync\Service\ContentSyncService();
|
||||||
$result = $service->syncAllTargets($targets);
|
$result = $service->syncAllTargets($targets);
|
||||||
|
|
||||||
$this->sendJson(200, $result);
|
$this->sendJson(200, $result);
|
||||||
+3
-3
@@ -24,7 +24,7 @@ use Joomla\CMS\MVC\Controller\BaseController;
|
|||||||
*/
|
*/
|
||||||
class SyncReceiveController extends BaseController
|
class SyncReceiveController extends BaseController
|
||||||
{
|
{
|
||||||
public function execute(): void
|
public function execute($task = 'syncReceive'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
@@ -52,10 +52,10 @@ class SyncReceiveController extends BaseController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$serviceFile = JPATH_PLUGINS . '/system/mokowaas/Service/ContentSyncReceiver.php';
|
$serviceFile = JPATH_PLUGINS . '/task/mokowaassync/src/Service/ContentSyncReceiver.php';
|
||||||
require_once $serviceFile;
|
require_once $serviceFile;
|
||||||
|
|
||||||
$receiver = new \Moko\Plugin\System\MokoWaaS\Service\ContentSyncReceiver();
|
$receiver = new \Moko\Plugin\Task\MokoWaaSSync\Service\ContentSyncReceiver();
|
||||||
$result = $receiver->receive($payload);
|
$result = $receiver->receive($payload);
|
||||||
|
|
||||||
$this->sendJson(200, $result);
|
$this->sendJson(200, $result);
|
||||||
+1
-1
@@ -29,7 +29,7 @@ class UpdateController extends BaseController
|
|||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function execute(): void
|
public function execute($task = 'update'): void
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
|
||||||
|
SPDX-LICENSE-IDENTIFIER: GPL-3.0-or-later
|
||||||
|
|
||||||
|
FILE INFORMATION
|
||||||
|
DEFGROUP: Joomla.Component
|
||||||
|
INGROUP: MokoWaaS
|
||||||
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoWaaS
|
||||||
|
VERSION: 02.34.16
|
||||||
|
PATH: /mokowaas.xml
|
||||||
|
BRIEF: Component manifest for MokoWaaS admin dashboard and REST API
|
||||||
|
-->
|
||||||
|
<extension type="component" method="upgrade">
|
||||||
|
<name>MokoWaaS</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>2026-06-02</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>02.34.15</version>
|
||||||
|
<description>MokoWaaS admin dashboard and REST API. Provides a control panel for managing MokoWaaS feature plugins, site health monitoring, and remote management endpoints.</description>
|
||||||
|
|
||||||
|
<namespace path="src">Moko\Component\MokoWaaS</namespace>
|
||||||
|
|
||||||
|
<administration>
|
||||||
|
<menu img="class:cogs">MokoWaaS</menu>
|
||||||
|
<submenu>
|
||||||
|
<menu link="option=com_mokowaas" img="class:cogs">COM_MOKOWAAS_MENU_DASHBOARD</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=extensions" img="class:puzzle-piece">COM_MOKOWAAS_MENU_EXTENSIONS</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=tickets" img="class:headphones">COM_MOKOWAAS_MENU_TICKETS</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=htaccess" img="class:file-code">COM_MOKOWAAS_MENU_HTACCESS</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=privacy" img="class:lock">COM_MOKOWAAS_MENU_PRIVACY</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=waflog" img="class:shield-alt">COM_MOKOWAAS_MENU_WAFLOG</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=database" img="class:database">COM_MOKOWAAS_MENU_DATABASE</menu>
|
||||||
|
<menu link="option=com_mokowaas&view=cleanup" img="class:trash">COM_MOKOWAAS_MENU_CLEANUP</menu>
|
||||||
|
<menu link="option=com_plugins&filter[folder]=system&filter[search]=mokowaas" img="class:power-off">COM_MOKOWAAS_MENU_PLUGINS</menu>
|
||||||
|
<menu link="option=com_installer&view=update" img="class:refresh">COM_MOKOWAAS_MENU_UPDATES</menu>
|
||||||
|
<menu link="option=com_checkin" img="class:check-square">COM_MOKOWAAS_MENU_CHECKIN</menu>
|
||||||
|
<menu link="option=com_cache" img="class:bolt">COM_MOKOWAAS_MENU_CACHE</menu>
|
||||||
|
</submenu>
|
||||||
|
<files folder="admin">
|
||||||
|
<filename>access.xml</filename>
|
||||||
|
<filename>catalog.xml</filename>
|
||||||
|
<filename>config.xml</filename>
|
||||||
|
<folder>language</folder>
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>sql</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="admin/language">
|
||||||
|
<language tag="en-GB">en-GB/com_mokowaas.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</administration>
|
||||||
|
|
||||||
|
<files folder="site">
|
||||||
|
<folder>language</folder>
|
||||||
|
<folder>services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<install>
|
||||||
|
<sql><file driver="mysql" charset="utf8">admin/sql/install.mysql.sql</file></sql>
|
||||||
|
</install>
|
||||||
|
|
||||||
|
<api>
|
||||||
|
<files folder="api">
|
||||||
|
<folder>src</folder>
|
||||||
|
</files>
|
||||||
|
</api>
|
||||||
|
|
||||||
|
<media destination="com_mokowaas" folder="media">
|
||||||
|
<folder>css</folder>
|
||||||
|
<folder>js</folder>
|
||||||
|
</media>
|
||||||
|
</extension>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
MOD_MOKOWAAS_CACHE="MokoWaaS Cache Cleaner"
|
||||||
|
MOD_MOKOWAAS_CACHE_DESC="One-click cache and temp cleaner in the admin status bar."
|
||||||
|
MOD_MOKOWAAS_CACHE_CLEAR_ALL="Clear All Cache"
|
||||||
|
MOD_MOKOWAAS_CACHE_CLEAR_TEMP="Clear Temp"
|
||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<license>GPL-3.0-or-later</license>
|
<license>GPL-3.0-or-later</license>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
<version>02.34.08-dev</version>
|
<version>02.34.15</version>
|
||||||
<description>MOD_MOKOWAAS_CACHE_DESC</description>
|
<description>MOD_MOKOWAAS_CACHE_DESC</description>
|
||||||
<namespace path="src">Moko\Module\MokoWaaSCache</namespace>
|
<namespace path="src">Moko\Module\MokoWaaSCache</namespace>
|
||||||
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MokoWaaS Cache & Temp Cleaner — status bar split button
|
||||||
|
*
|
||||||
|
* Displays "Clear: Cache | Temp" as a single header item with two
|
||||||
|
* clickable halves. Uses native Atum header-item markup.
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
|
||||||
|
$token = Session::getFormToken();
|
||||||
|
$cacheUrl = 'index.php?option=com_mokowaas&task=clearCache&format=json';
|
||||||
|
$tempUrl = 'index.php?option=com_mokowaas&task=clearTemp&format=json';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.mokowaas-cleaner { display:flex; align-items:center; gap:0; padding:0 0.25rem; }
|
||||||
|
.mokowaas-cleaner-label { font-size:0.8rem; color:var(--template-text-dark,#495057); white-space:nowrap; padding-inline-end:0.35rem; }
|
||||||
|
.mokowaas-cleaner-btn { cursor:pointer; padding:0.2rem 0.5rem; font-size:0.8rem; border-radius:3px; text-decoration:none; color:var(--template-text-dark,#495057); transition:background 0.15s; white-space:nowrap; }
|
||||||
|
.mokowaas-cleaner-btn:hover { background:rgba(0,0,0,0.08); color:var(--template-text-dark,#212529); text-decoration:none; }
|
||||||
|
.mokowaas-cleaner-sep { color:var(--template-text-dark,#adb5bd); padding:0 0.1rem; font-size:0.8rem; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="header-item-content mokowaas-cleaner">
|
||||||
|
<span class="mokowaas-cleaner-label">Clear:</span>
|
||||||
|
<a href="#" class="mokowaas-cleaner-btn" id="mokowaas-clear-cache" title="Clear all Joomla cache">
|
||||||
|
<span class="icon-bolt" aria-hidden="true" id="mokowaas-cache-icon"></span> Cache
|
||||||
|
</a>
|
||||||
|
<span class="mokowaas-cleaner-sep">|</span>
|
||||||
|
<a href="#" class="mokowaas-cleaner-btn" id="mokowaas-clear-temp" title="Clear temp directory">
|
||||||
|
<span class="icon-trash" aria-hidden="true" id="mokowaas-temp-icon"></span> Temp
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
function setupCleaner(btnId, iconId, url, token) {
|
||||||
|
var btn = document.getElementById(btnId);
|
||||||
|
var icon = document.getElementById(iconId);
|
||||||
|
if (!btn || !icon) return;
|
||||||
|
var origClass = icon.className;
|
||||||
|
|
||||||
|
btn.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (btn.dataset.busy) return;
|
||||||
|
btn.dataset.busy = '1';
|
||||||
|
icon.className = 'icon-spinner icon-spin';
|
||||||
|
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append(token, '1');
|
||||||
|
|
||||||
|
fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(function(r) { return r.json(); })
|
||||||
|
.then(function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
icon.className = 'icon-check';
|
||||||
|
icon.style.color = '#198754';
|
||||||
|
} else {
|
||||||
|
icon.className = 'icon-times';
|
||||||
|
icon.style.color = '#dc3545';
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
icon.className = origClass;
|
||||||
|
icon.style.color = '';
|
||||||
|
delete btn.dataset.busy;
|
||||||
|
}, 2000);
|
||||||
|
})
|
||||||
|
.catch(function() {
|
||||||
|
icon.className = 'icon-times';
|
||||||
|
icon.style.color = '#dc3545';
|
||||||
|
setTimeout(function() {
|
||||||
|
icon.className = origClass;
|
||||||
|
icon.style.color = '';
|
||||||
|
delete btn.dataset.busy;
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setupCleaner('mokowaas-clear-cache', 'mokowaas-cache-icon', '<?php echo $cacheUrl; ?>', '<?php echo $token; ?>');
|
||||||
|
setupCleaner('mokowaas-clear-temp', 'mokowaas-temp-icon', '<?php echo $tempUrl; ?>', '<?php echo $token; ?>');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
MOD_MOKOWAAS_CATEGORIES="MokoWaaS Categories"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_DESC="Auto-discovers article categories and renders them as a collapsible tree menu. Ideal for knowledge base and help sections."
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ROOT_LABEL="Root Category"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ROOT_DESC="Select a parent category. Only its children (and their subcategories) will be displayed. Leave as All to show the entire category tree."
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ALL_CATEGORIES="- All Categories -"
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_DEPTH_LABEL="Maximum Depth"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_DEPTH_DESC="How many levels deep to display. 1 shows only top-level categories, 2 adds one level of subcategories, etc."
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_COUNT_LABEL="Show Article Count"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_COUNT_DESC="Display the number of published articles next to each category name."
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_EMPTY_LABEL="Show Empty Categories"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_EMPTY_DESC="Display categories that have no published articles. Only applies when Show Article Count is enabled."
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_MENUITEM_LABEL="Target Menu Item"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_MENUITEM_DESC="The menu item to use as the base for category links. This sets the Itemid parameter for proper template and menu highlighting."
|
||||||
|
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ORDER_LABEL="Category Ordering"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ORDER_DESC="How to sort categories within each level."
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ORDER_TREE="Tree Order (default)"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ORDER_TITLE="Alphabetical"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_ORDER_CREATED="Date Created"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
MOD_MOKOWAAS_CATEGORIES="MokoWaaS Categories"
|
||||||
|
MOD_MOKOWAAS_CATEGORIES_DESC="Auto-discovers article categories and renders them as a collapsible tree menu. Ideal for knowledge base and help sections."
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="module" client="administrator" method="upgrade">
|
||||||
|
<name>mod_mokowaas_categories</name>
|
||||||
|
<author>Moko Consulting</author>
|
||||||
|
<creationDate>2026-06-06</creationDate>
|
||||||
|
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||||
|
<license>GPL-3.0-or-later</license>
|
||||||
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
|
<version>02.34.15</version>
|
||||||
|
<description>MOD_MOKOWAAS_CATEGORIES_DESC</description>
|
||||||
|
<namespace path="src">Moko\Module\MokoWaaSCategories</namespace>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<folder module="mod_mokowaas_categories">services</folder>
|
||||||
|
<folder>src</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<languages folder="language">
|
||||||
|
<language tag="en-GB">en-GB/mod_mokowaas_categories.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/mod_mokowaas_categories.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<config>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic">
|
||||||
|
<field name="root_category" type="category"
|
||||||
|
extension="com_content"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_ROOT_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_ROOT_DESC"
|
||||||
|
default="0"
|
||||||
|
show_root="true"
|
||||||
|
>
|
||||||
|
<option value="0">MOD_MOKOWAAS_CATEGORIES_ALL_CATEGORIES</option>
|
||||||
|
</field>
|
||||||
|
<field name="max_depth" type="number"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_DEPTH_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_DEPTH_DESC"
|
||||||
|
default="3"
|
||||||
|
min="1"
|
||||||
|
max="10"
|
||||||
|
/>
|
||||||
|
<field name="show_article_count" type="radio"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_COUNT_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_COUNT_DESC"
|
||||||
|
default="1"
|
||||||
|
class="btn-group btn-group-yesno">
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
<field name="show_empty" type="radio"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_EMPTY_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_EMPTY_DESC"
|
||||||
|
default="0"
|
||||||
|
class="btn-group btn-group-yesno">
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
<field name="menu_item_id" type="menuitem"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_MENUITEM_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_MENUITEM_DESC"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
<field name="ordering" type="list"
|
||||||
|
label="MOD_MOKOWAAS_CATEGORIES_ORDER_LABEL"
|
||||||
|
description="MOD_MOKOWAAS_CATEGORIES_ORDER_DESC"
|
||||||
|
default="lft">
|
||||||
|
<option value="lft">MOD_MOKOWAAS_CATEGORIES_ORDER_TREE</option>
|
||||||
|
<option value="title">MOD_MOKOWAAS_CATEGORIES_ORDER_TITLE</option>
|
||||||
|
<option value="created_time">MOD_MOKOWAAS_CATEGORIES_ORDER_CREATED</option>
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</config>
|
||||||
|
</extension>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user