Commit Graph
4 Commits
Author SHA1 Message Date
Thomas Vincent 79a9ae0351 build: raise the 1.3 floor to PHP 8.3 (#7939)
* build: raise the 1.3 floor to PHP 8.3

RHEL 10 ships 8.3 in AppStream and dropped modularity, so an 8.4 floor would
put every RHEL, Alma and Rocky 10 install on Remi. Ubuntu 24.04 is 8.3 as
well, which makes it the lowest common denominator of the current LTS fleet.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: raise the documented PHP floor to 8.3

The 1.2.x column keeps 8.1, which still matches that branch's composer constraint.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: run process lock coverage on PHP 8.3

* fix: finish PHP 8.3 floor cleanup

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-09-06 08:44:40 -07:00
Thomas Vincent a8e1afba73 Refuse to serve the REST scaffold unless it is switched on (#7716)
* security(api): refuse to serve the REST scaffold unless it is switched on

No route in it consults a realm, a session or a token, and only the missing
vendor tree was keeping the endpoints quiet.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(api): refuse with an empty 404 and use tabs in the test

A JSON error body confirmed an API was behind the refusal, which is what the
404 was chosen to avoid.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: resolve includes through Cacti path constants

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: assert the include form the bootstrap can actually use

CACTI_PATH_INCLUDE is defined by global.php, so it does not exist at the
point that includes it. The file anchors on __DIR__ like its neighbours.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-08-21 12:30:21 -07:00
Thomas Vincent 710a533f5a docs: fix typos and grammar in api, locales, and service READMEs (#6690)
* docs: fix typos and grammar in api, locales, and service READMEs

api/README.md: fix PHP version requirement (7.4→8.1), replace
incorrect WSGI reference, fix formatting and punctuation.

locales/README.md: fix grammar (The the→While the), correct
spelling (on boarded→onboarded), fix typos (of if→or, if).

service/README.md: fix grammar (entering→entered, it's→its),
correct Debian user/group (www-run:www→www-data:www-data),
fix wording (for as a future→as a future, over write→overwrite).

No content changes; copy-editing only.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: add router script to PHP built-in server command

PHP's built-in server doesn't route non-file paths to index.php
by default, so Slim endpoints return 404. Adding public/index.php
as the router script argument fixes this.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-03-02 08:57:28 -05:00
6de44a0fe7 Cacti Restuful API V0.1 (#6310)
* inital commit

* remove composer files

* Update api/public/index.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/include/db_functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add API Versioning

- Group Endpoint types together
- Add initial V1 endpoint groups
- Leverage the slim  route collector class

* Migrate db functions to Cacti core  db functions

* remove dedicated config file

* Update README.md

* Update db_functions.php

- include global and not the lib/database
- remove redudant db_connect function

* Sanity checks

- Ensure arrays are initialized before iterating

* Update db_functions.php

* Add logging

* helper function for parameter validation

* Update api/include/db_functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Sanitize error message

* Update db_functions.php

use the proper cacti db function
Leverage the read_config_option function instead of standalone db query

* Update api/include/db_functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Cleaning up  from pre migration to core cacti functions

* clean up

* update tholds endpoint

Call on the validate parameters helper function

* call on db_fetch_cell for thold db_function

* Update api/public/index.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Creat automation networks api endpoint

Call the proper db prepared function for prepared statments

* automation status endpoint

* data source stats status endpoint

* add validations (more to come)

* validations

* Update api/include/arrays.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/include/db_functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/include/arrays.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/include/db_functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor validation error handling in API routes

This changes adds a small bit of PSR formatting to the code, and reduces the length of the $validation_error by renaming to $verror for redability.

* Clean up whitespace in arrays.php

* Refactor SQL queries for improved readability

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2025-09-11 13:06:45 -04:00