You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Auto-create 'Initial Operating System' and 'Initial SSH Key' custom fields
via Database::ensureCustomFields() on module load, eliminating the manual
modify.sql step
- Delete modify.sql (no longer needed)
- Add try/catch blocks around every DB operation and API call across all PHP
files per CLAUDE.md error handling rules
- Add comprehensive PHPDoc to all classes, methods, and properties
- Set up Laravel Pint (laravel/pint) with Laravel-style preset for consistent
code formatting across the codebase
- Add git pre-commit hook (hooks/pre-commit) that runs Pint on staged PHP
files, auto-installed via Composer post-install/post-update scripts
- Simplify README installation to a single copy-paste command
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,8 @@ The `publish-release.yml` workflow creates a GitHub/Gitea release with auto-gene
91
91
6. Updates WHMCS hosting record (IP, username, password, domain)
92
92
7. Calls `ConfigureService::initServerBuild()` with selected OS + SSH key
93
93
94
+
Custom fields (`Initial Operating System`, `Initial SSH Key`) are auto-created by `Database::ensureCustomFields()` on module load for all products using this module. No manual SQL setup required.
95
+
94
96
### Configurable Option Mapping
95
97
96
98
Custom option names can be mapped in `config/ConfigOptionMapping.php` (copy from `-example.php`). Default mapping keys: `packageId`, `hypervisorId`, `ipv4`, `storage`, `memory`, `traffic`, `cpuCores`, `networkSpeedInbound`, `networkSpeedOutbound`, `networkProfile`, `storageProfile`.
Copy file name to clipboardExpand all lines: README.md
+11-90Lines changed: 11 additions & 90 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,95 +108,28 @@ You also need a VirtFusion API token with the following permissions:
108
108
109
109
## Installation
110
110
111
-
### Step 1: Download & Install
112
-
113
-
Download the latest release from the [releases](https://github.com/EZSCALE/virtfusion-whmcs-module/releases) page, or install directly via the command line:
Replace `/path/to/whmcs` with your actual WHMCS installation root. The database table, schema migrations, and custom fields are all created automatically on first load.
153
116
154
-
1. Go to **Configuration > System Settings > Servers**
-**Hostname**: Your VirtFusion panel hostname (e.g., `cp.example.com`)
159
-
-**Type**: VirtFusion Direct Provisioning
160
-
-**Password/Access Hash**: Your VirtFusion API token
161
-
4. Click **Test Connection** to verify
162
-
5. Click **Save Changes**
117
+
Then configure in WHMCS Admin:
163
118
164
-
### Step 3: Create Product
119
+
1.**Add Server** — Configuration > System Settings > Servers > Add New Server. Set hostname to your VirtFusion panel (e.g. `cp.example.com`), type to "VirtFusion Direct Provisioning", and paste your API token in the Password field. Click **Test Connection** to verify.
120
+
2.**Create Product** — Configuration > System Settings > Products/Services. On the Module Settings tab, select "VirtFusion Direct Provisioning", choose your server, and set the Hypervisor Group ID, Package ID, and Default IPv4 count.
165
121
166
-
1. Go to **Configuration > System Settings > Products/Services**
167
-
2. Create a new product or edit an existing one
168
-
3. On the **Module Settings** tab:
169
-
- Set **Module Name** to "VirtFusion Direct Provisioning"
170
-
- Select your VirtFusion server
171
-
- Set **Hypervisor Group ID**, **Package ID**, and **Default IPv4** count
172
-
4. Save the product
173
-
174
-
### Step 4: Set Up Custom Fields
175
-
176
-
See [Custom Fields](#custom-fields) section below.
177
-
178
-
### Step 5: Activate Hooks
179
-
180
-
The hooks file (`hooks.php`) is automatically detected by WHMCS when the module is active. If you add the module files to an existing installation, you may need to re-save the product settings or clear the WHMCS template cache for hooks to take effect.
122
+
That's it. Hooks activate automatically and custom fields are created on module load.
181
123
182
124
## Upgrading
183
125
184
-
1. Back up your existing `modules/servers/VirtFusionDirect/` directory
185
-
2. Back up `config/ConfigOptionMapping.php` if you have a custom mapping
4. Restore your custom `config/ConfigOptionMapping.php` if applicable
196
-
5. If you have theme-overridden templates, review them for any new template variables
197
-
6. Clear the WHMCS template cache: **Configuration > System Settings > General Settings > clear template cache**
130
+
> **Note:** If you have a custom `config/ConfigOptionMapping.php`, back it up first — `--delete` will remove it. Restore it after upgrading.
198
131
199
-
The module database table (`mod_virtfusion_direct`) is automatically migrated on first load.
132
+
If you use theme-overridden templates, review them for any new template variables. Clear the WHMCS template cache after upgrading: **Configuration > System Settings > General Settings > clear template cache**.
200
133
201
134
## Configuration
202
135
@@ -222,20 +155,9 @@ Each WHMCS product using this module needs:
222
155
223
156
### Custom Fields
224
157
225
-
You **must**create two custom fields on each product that uses this module:
158
+
The module requires two custom fields per product: **Initial Operating System**and **Initial SSH Key**. These are **automatically created** when the module loads — no manual setup required.
226
159
227
-
| Field Name | Field Type | Show on Order Form | Admin Only | Required |
228
-
|---|---|---|---|---|
229
-
| Initial Operating System | Text Box | Yes | No | No |
230
-
| Initial SSH Key | Text Box | Yes | No | No |
231
-
232
-
These fields are hidden text boxes that are dynamically replaced by dropdown selects via JavaScript hooks on the order form.
233
-
234
-
**Automated setup**: Run the SQL from [modify.sql](modify.sql) to auto-create these fields for all VirtFusion products:
235
-
236
-
```bash
237
-
mysql -u whmcs_user -p whmcs_database < modules/servers/VirtFusionDirect/modify.sql
238
-
```
160
+
The fields are hidden text boxes that are dynamically replaced by dropdown selects via JavaScript hooks on the order form. They are created for every product with the module type set to "VirtFusion Direct Provisioning".
0 commit comments