Skip to content

Commit 54ad0c9

Browse files
committed
updates adding tests in and updating readme/composer file
1 parent a7238e2 commit 54ad0c9

6 files changed

Lines changed: 1233 additions & 127 deletions

File tree

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php-version: ['8.1', '8.2', '8.3']
17+
18+
name: PHP ${{ matrix.php-version }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php-version }}
28+
extensions: soap
29+
coverage: xdebug
30+
31+
- name: Install dependencies
32+
run: composer install --prefer-dist --no-progress
33+
34+
- name: Run tests
35+
run: vendor/bin/phpunit --coverage-text

README.md

Lines changed: 70 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,81 @@
1-
# Cpanel Licensing Class
2-
3-
Cpanel Licensing Class
4-
5-
6-
In admin Licensing menu theres a 'CPanel Packages' link now that shows a display of the packages
7-
8-
9-
10-
## New Cpanel Licenses Type Update
11-
12-
The CPanel licenses are undergoing as major change heres wwhats left on the work to migrate to the new setup
13-
14-
15-
### Potential Issues and thigns to address
16-
17-
* If there is a commmunication problem loading the license data from cpanel ensure that it does not set some crazy values; but instead bails or retries
18-
* For reactivation of a license, it would go by the last known / billed invoice amount right or would the cost for reactivation be reset back to the minimmum amounts where we assume no accounts?
19-
* Price increase is scheduled for September 1st, 2019. https://www.interserver.net/tips/kb/cpanel-price-increase-and-alternative-control-panels/
20-
21-
### Full New Package Offering
22-
23-
This is the complete list of licenses we can order including both old and new ones.
24-
25-
* P1814 INTERSERVER-INTERNAL-VPS
26-
* P188 INTERSERVER-INTERNAL-VZZO
27-
* P21159 cPanel Admin Cloud
28-
* P21163 cPanel Pro Cloud
29-
* P21167 cPanel Premier Cloud
30-
* P21171 cPanel Premier Metal
31-
* P21175 cPanel Admin Cloud (Distributor)
32-
* P21179 cPanel Pro Cloud (Distributor)
33-
* P21183 cPanel Premier Cloud (Distributor)
34-
* P21187 cPanel Premier Metal (Distributor)
35-
* P21893 cPanel Autoscale (Internal)
36-
* P21897 cPanel Autoscale (External)
37-
* P22081 cPanel Plus Cloud
38-
* P2466 INTERSERVER-ENKOMP-INTERNAL-A500
39-
* P2470 INTERSERVER-ENKOMP-EXTERNAL-A500
40-
* P24765 DNSNODECLOUD
41-
* P24769 DNSNODEMETAL
42-
* P24925 cPanel Premier Cloud 150
43-
* P24929 cPanel Premier Cloud 200
44-
* P24933 cPanel Premier Cloud 250
45-
* P24937 cPanel Premier Cloud 300
46-
* P24941 cPanel Premier Cloud 350
47-
* P24945 cPanel Premier Cloud 400
48-
* P24949 cPanel Premier Cloud 450
49-
* P24953 cPanel Premier Cloud 500
50-
* P24957 cPanel Premier Cloud 550
51-
* P24961 cPanel Premier Cloud 600
52-
* P24965 cPanel Premier Cloud 650
53-
* P24969 cPanel Premier Cloud 700
54-
* P24973 cPanel Premier Cloud 750
55-
* P24977 cPanel Premier Cloud 800
56-
* P24981 cPanel Premier Cloud 850
57-
* P24985 cPanel Premier Cloud 900
58-
* P24989 cPanel Premier Cloud 950
59-
* P24993 cPanel Premier Cloud 1000
60-
* P25277 cPanel Premier Metal 150
61-
* P25281 cPanel Premier Metal 200
62-
* P25285 cPanel Premier Metal 250
63-
* P25289 cPanel Premier Metal 300
64-
* P25293 cPanel Premier Metal 350
65-
* P25297 cPanel Premier Metal 400
66-
* P25301 cPanel Premier Metal 450
67-
* P25305 cPanel Premier Metal 500
68-
* P25309 cPanel Premier Metal 550
69-
* P25313 cPanel Premier Metal 600
70-
* P25317 cPanel Premier Metal 650
71-
* P25321 cPanel Premier Metal 700
72-
* P25325 cPanel Premier Metal 750
73-
* P25329 cPanel Premier Metal 800
74-
* P25333 cPanel Premier Metal 850
75-
* P25337 cPanel Premier Metal 900
76-
* P25341 cPanel Premier Metal 950
77-
* P25345 cPanel Premier Metal 1000
78-
* P29017 cPanel Premier Cloud 100
79-
* P29021 cPanel Premier Metal 100
80-
* P401 INTERSERVER-EXTERNAL
81-
* P559 INTERSERVER-EXTERNAL-VPS
82-
* P560 INTERSERVER-EXTERNAL-VZZO
83-
* P576 INTERSERVER-INTERNAL
84-
85-
86-
### Current/Old Packages
87-
88-
We currently use these packages (which will be getting changed intot he new ones)
89-
90-
* P1814 INTERSERVER-INTERNAL-VPS
91-
* P188 INTERSERVER-INTERNAL-VZZO
92-
* P576 INTERSERVER-INTERNAL
93-
* P559 INTERSERVER-EXTERNAL-VPS
94-
* P560 INTERSERVER-EXTERNAL-VZZO
95-
* P401 INTERSERVER-EXTERNAL
96-
97-
98-
## New Packages
99-
100-
These are the packages we'll be using and vonerting all the existing packages to
101-
102-
* P21893 cPanel Autoscale (Internal)
103-
* P21897 cPanel Autoscale (External)
104-
105-
106-
https://tldr.ostera.io/
107-
108-
109-
## Build Status and Code Analysis
110-
111-
Site | Status
112-
--------------|---------------------------
113-
![Travis-CI](http://i.is.cc/storage/GYd75qN.png "Travis-CI") | [![Build Status](https://travis-ci.org/detain/myadmin-cpanel-licensing.svg?branch=master)](https://travis-ci.org/detain/myadmin-cpanel-licensing)
114-
![CodeClimate](http://i.is.cc/storage/GYlageh.png "CodeClimate") | [![Code Climate](https://codeclimate.com/github/detain/myadmin-cpanel-licensing/badges/gpa.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-licensing) [![Test Coverage](https://codeclimate.com/github/detain/myadmin-cpanel-licensing/badges/coverage.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-licensing/coverage) [![Issue Count](https://codeclimate.com/github/detain/myadmin-cpanel-licensing/badges/issue_count.svg)](https://codeclimate.com/github/detain/myadmin-cpanel-licensing)
115-
![Scrutinizer](http://i.is.cc/storage/GYeUnux.png "Scrutinizer") | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/badges/build.png?b=master)](https://scrutinizer-ci.com/g/myadmin-plugins/cpanel-licensing/build-status/master)
116-
![Codacy](http://i.is.cc/storage/GYi66Cx.png "Codacy") | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/226251fc068f4fd5b4b4ef9a40011d06)](https://www.codacy.com/app/detain/myadmin-cpanel-licensing) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/25fa74eb74c947bf969602fcfe87e349)](https://www.codacy.com/app/detain/myadmin-cpanel-licensing?utm_source=github.com&utm_medium=referral&utm_content=detain/myadmin-cpanel-licensing&utm_campaign=Badge_Coverage)
117-
![Coveralls](http://i.is.cc/storage/GYjNSim.png "Coveralls") | [![Coverage Status](https://coveralls.io/repos/github/detain/db_abstraction/badge.svg?branch=master)](https://coveralls.io/github/detain/myadmin-cpanel-licensing?branch=master)
118-
![Packagist](http://i.is.cc/storage/GYacBEX.png "Packagist") | [![Latest Stable Version](https://poser.pugx.org/detain/myadmin-cpanel-licensing/version)](https://packagist.org/packages/detain/myadmin-cpanel-licensing) [![Total Downloads](https://poser.pugx.org/detain/myadmin-cpanel-licensing/downloads)](https://packagist.org/packages/detain/myadmin-cpanel-licensing) [![Latest Unstable Version](https://poser.pugx.org/detain/myadmin-cpanel-licensing/v/unstable)](//packagist.org/packages/detain/myadmin-cpanel-licensing) [![Monthly Downloads](https://poser.pugx.org/detain/myadmin-cpanel-licensing/d/monthly)](https://packagist.org/packages/detain/myadmin-cpanel-licensing) [![Daily Downloads](https://poser.pugx.org/detain/myadmin-cpanel-licensing/d/daily)](https://packagist.org/packages/detain/myadmin-cpanel-licensing) [![License](https://poser.pugx.org/detain/myadmin-cpanel-licensing/license)](https://packagist.org/packages/detain/myadmin-cpanel-licensing)
1+
# MyAdmin cPanel Licensing Plugin
1192

3+
[![Tests](https://github.com/detain/myadmin-cpanel-licensing/actions/workflows/tests.yml/badge.svg)](https://github.com/detain/myadmin-cpanel-licensing/actions/workflows/tests.yml)
4+
[![Latest Stable Version](https://poser.pugx.org/detain/myadmin-cpanel-licensing/version)](https://packagist.org/packages/detain/myadmin-cpanel-licensing)
5+
[![Total Downloads](https://poser.pugx.org/detain/myadmin-cpanel-licensing/downloads)](https://packagist.org/packages/detain/myadmin-cpanel-licensing)
6+
[![License](https://poser.pugx.org/detain/myadmin-cpanel-licensing/license)](https://packagist.org/packages/detain/myadmin-cpanel-licensing)
7+
8+
A MyAdmin plugin that integrates cPanel license management into the MyAdmin billing and administration platform. It provides automated provisioning, activation, deactivation, IP changes, and billing reconciliation for cPanel licenses through the cPanel Manage2 API.
9+
10+
## Features
11+
12+
- Activate and deactivate cPanel licenses via the cPanel Manage2 API
13+
- Change the IP address associated with a cPanel license
14+
- Verify license status for a given IP
15+
- Retrieve license data and account lists by IP
16+
- KernelCare and Ksplice addon license management
17+
- Admin view of all active cPanel licenses
18+
- Unbilled license detection and reporting
19+
- Symfony EventDispatcher integration for the MyAdmin plugin system
20+
21+
## Requirements
22+
23+
- PHP >= 5.0
24+
- ext-soap
25+
- symfony/event-dispatcher ^5.0
26+
- detain/cpanel-licensing (cPanel Manage2 API wrapper)
12027

12128
## Installation
12229

123-
Install with composer like
30+
Install with Composer:
12431

12532
```sh
12633
composer require detain/myadmin-cpanel-licensing
12734
```
12835

129-
## License
36+
## Usage
37+
38+
The plugin registers itself with the MyAdmin framework through event hooks. It is loaded automatically by the plugin system when installed.
39+
40+
### Plugin Hooks
41+
42+
The plugin listens on the following events:
43+
44+
| Event | Handler | Description |
45+
|---|---|---|
46+
| `licenses.settings` | `getSettings` | Registers cPanel configuration fields |
47+
| `licenses.activate` | `getActivate` | Provisions a new cPanel license |
48+
| `licenses.reactivate` | `getActivate` | Re-provisions an expired license |
49+
| `licenses.deactivate` | `getDeactivate` | Expires a cPanel license |
50+
| `licenses.deactivate_ip` | `getDeactivateIp` | Expires a license by IP |
51+
| `licenses.change_ip` | `getChangeIp` | Moves a license to a new IP |
52+
| `function.requirements` | `getRequirements` | Registers function autoloading |
53+
| `ui.menu` | `getMenu` | Adds admin menu entries |
54+
55+
### Standalone Functions
13056

131-
The Cpanel Licensing Class class is licensed under the LGPL-v2.1 license.
57+
The package also provides procedural helper functions:
58+
59+
- `activate_cpanel($ip, $package)` - Activate a license for an IP with a given package ID
60+
- `deactivate_cpanel($ip)` - Deactivate a license by IP
61+
- `verify_cpanel($ip)` - Check if a license is active
62+
- `get_cpanel_license_data_by_ip($ip)` - Get full license details
63+
- `get_cpanel_licenses()` - List all licenses on the account
64+
- `get_cpanel_accounts_for_license_ip($ip)` - Get accounts for a licensed IP
65+
66+
## Running Tests
67+
68+
```sh
69+
composer install
70+
vendor/bin/phpunit
71+
```
72+
73+
To generate a coverage report:
74+
75+
```sh
76+
vendor/bin/phpunit --coverage-html coverage/
77+
```
78+
79+
## License
13280

81+
This package is licensed under the [LGPL-2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license.

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
"detain/cpanel-licensing": "dev-master"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "*",
30-
"phpunit/phpunit-mock-objects": "*",
31-
"vlucas/phpdotenv": "*",
32-
"codeclimate/php-test-reporter": "*",
33-
"satooshi/php-coveralls": "*",
34-
"codacy/coverage": "*"
29+
"phpunit/phpunit": "^9.6"
3530
},
3631
"autoload": {
3732
"psr-4": {
3833
"MyAdmin\\Licenses\\Cpanel\\": "src/"
3934
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"MyAdmin\\Licenses\\Cpanel\\Tests\\": "tests/"
39+
}
4040
}
4141
}

phpunit.xml.dist

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheResultFile=".phpunit.cache/test-results"
6+
colors="true"
7+
executionOrder="depends,defects"
8+
forceCoversAnnotation="false"
9+
beStrictAboutCoversAnnotation="false"
10+
beStrictAboutOutputDuringTests="true"
11+
beStrictAboutTodoAnnotatedTests="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
14+
verbose="true">
15+
<testsuites>
16+
<testsuite name="Unit">
17+
<directory suffix="Test.php">tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<coverage cacheDirectory=".phpunit.cache/code-coverage"
22+
processUncoveredFiles="true">
23+
<include>
24+
<directory suffix=".php">src</directory>
25+
</include>
26+
</coverage>
27+
</phpunit>

0 commit comments

Comments
 (0)