Add PHP include paths, update dev process

dev
gravel 2 years ago
parent 6785454494
commit b23cecc693
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -1,5 +1,6 @@
<?php
$PROJECT_ROOT=__DIR__;
$PHP_ROOT="$PROJECT_ROOT/php";
$CACHE_ROOT="$PROJECT_ROOT/cache";
$ROOMS_FILE="$CACHE_ROOT/rooms.json";
$DOCUMENT_ROOT="$PROJECT_ROOT/output";
@ -19,6 +20,12 @@
$REPOSITORY_CANONICAL_URL="https://codeberg.org/gravel/sessioncommunities.online";
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
$PHP_ROOT,
$PROJECT_ROOT
)));
// do not report warnings (timeouts, SSL/TLS errors)
error_reporting(E_ALL & ~E_WARNING);

@ -23,14 +23,19 @@
### Development
Run at least once: `make fetch` to query servers. This can take around 5 minutes.
Run at least once: `make fetch` to query servers. This takes around 15 seconds thanks to the coroutine implementation.
Run when developing: `make dev` to watch for changes & serve HTML locally in browser.
Symlink the commit hooks provided in [`etc/hooks`](etc/hooks/) to `.git/hooks/<hook>` to run a full test cycle when committing to main.
See [`Makefile`](Makefile) for more details.
Recommended:
- Add the [default include paths](.phpenv) (`.`, `php`) to your PHP intellisense.
- Symlink the commit hooks provided in [`etc/hooks`](etc/hooks/) to `.git/hooks/<hook>` to run a full test cycle when committing to main.
### Running your own copy
- point your webserver at the [`output`](output/) folder

@ -1,8 +1,8 @@
<?php
// Perform static site generation.
require_once "getenv.php";
require_once "utils/getopt.php";
require_once 'getenv.php';
require_once 'utils/getopt.php';
// https://stackoverflow.com/a/17161106
function rglob($pattern, $flags = 0) {

@ -1,7 +1,7 @@
<?php
require_once "getenv.php";
require_once "$PROJECT_ROOT/php/utils/servers-rooms.php";
require_once "$PROJECT_ROOT/php/utils/logging.php";
require_once "php/utils/servers-rooms.php";
require_once "php/utils/logging.php";
class CommunityListing implements JsonSerializable {
public readonly string $id;

@ -1,5 +1,5 @@
<?php
include_once "$PROJECT_ROOT/php/utils/logging.php";
include_once 'logging.php';
// Read the -v|--verbose option increasing logging verbosity to debug.
$options = getopt("vn", ["verbose", "fast", "no-color", "dry-run"]);

@ -1,5 +1,5 @@
<?php
require_once "$PROJECT_ROOT/php/servers/known-servers.php";
require_once 'servers/known-servers.php';
/**
* Return local path to room icon.

@ -1,6 +1,6 @@
<?php
require_once "$PROJECT_ROOT/php/servers/known-servers.php";
require_once "$PROJECT_ROOT/php/utils/room-icons.php";
require_once 'servers/known-servers.php';
require_once 'utils/room-icons.php';
/**
* Fetch the icon of the given Community server and return its relative path.

@ -1,7 +1,6 @@
<?php
require_once "$PROJECT_ROOT/languages/language_flags.php";
require_once "$PROJECT_ROOT/php/servers/known-servers.php";
require_once 'languages/language_flags.php';
require_once 'servers/known-servers.php';
require_once 'tags.php';
require_once 'fetching-coroutines.php';
require_once 'room-icons.php';

@ -1,9 +1,9 @@
<?php
// prerequisite include for sites and components
require_once "+getenv.php";
require_once "$PROJECT_ROOT/php/utils/utils.php";
require_once "$PROJECT_ROOT/php/utils/servers-rooms.php";
require_once "$PROJECT_ROOT/php/utils/getopt.php";
require_once '+getenv.php';
require_once 'php/utils/utils.php';
require_once 'php/utils/servers-rooms.php';
require_once 'php/utils/getopt.php';
// Read the server data from disk.
$servers_raw = file_get_contents($ROOMS_FILE);

Loading…
Cancel
Save