BlowfishCMS
A small content management system for OpenBSD
version 0.45.6 · ISC · 2026-12-03 · releases
30 lines · 1.8 KB · download this file
#!/usr/bin/perl
# BlowfishCMS as a CGI script: one process per request. The application lives
# in lib/BlowfishCMS.pm and lib/BlowfishCMS/; bin/blowfish-fcgi runs the same code as
# a persistent FastCGI service.
use v5.36;
# FindBin tells us the folder this script is in, so the line below can add
# the release's own lib/ folder to Perl's module search path. That way the
# script works from wherever the release is unpacked (/opt/blowfishcms, a
# test checkout, a staged update) without any installed Perl modules of ours.
use FindBin;
use lib "$FindBin::Bin/../lib";
use BlowfishCMS;
# Maintenance modes, run by the deploy, setup and cron scripts (which look for
# these names here before using them).
# The allowed maintenance options. map turns the list into a hash
# (option => 1) so "is this one of ours?" is a single lookup. Each one is
# handled by BlowfishCMS::cli() in lib/BlowfishCMS.pm.
my %modes=map {$_=>1} ('--migrate','--hourly','--comments-init','--set-password','--users-count','--places-check','--mfa-off','--backup-plan','--addons','--addon-enable','--addon-disable','--themes','--theme-forget','--notices-pending','--notices-emailed','--alert-mail','--mail-send','--updates','--import-videos','--addons-in');
# Called with arguments: a maintenance command from blowfishctl or cron.
# Unknown options are refused rather than ignored, so a typo in a script
# fails loudly. cli() returns the exit status for the shell.
if (@ARGV) {
die "Unknown option $ARGV[0]; use one of: ".join(' ',sort keys %modes)."\n" unless $modes{$ARGV[0]};
exit BlowfishCMS::cli(@ARGV);
}
# Called without arguments: a web request. The request details arrive in
# the environment (REQUEST_METHOD, SCRIPT_NAME, QUERY_STRING, ...) and the
# body on standard input; the response goes to standard output.
BlowfishCMS::handle_request();