[sf-lug] Done: bye-bye PHP - at least from SF-LUG's main web page

Michael Paoli michael.paoli at berkeley.edu
Mon Dec 8 22:42:36 PST 2025


On Thu, Dec 4, 2025 at 8:54 AM Michael Paoli <michael.paoli at berkeley.edu> wrote:
>
> And, the existing, uses wee bit 'o PHP.  Long ago Jim expressed interest to
> gut that (only updates the next meeting date), and instead just have something
> simply cron driven to do that.  (JavaScript could do it too, but not
> all browsers/clients
> necessarily have JavaScript and have it enabled).  And of course someone quite
> volunteered to do that, but never even got close to completing it (or
> even starting it).

So, stripped the PHP from SF-LUG's main web page, file also renamed from
index.php to index.html (/index.{php,html} redirects to /, as has been
the case for a very long time now - better SEO, and users shouldn't care
nor need specify, and should get (correct) page regardless).

Also, for the meeting schedule that had been handled via PHP, that's now
static in the HTML, and updated by crontab driven program.
$ id -nu && crontab -l
sflugwww
0,30 * * * * "$HOME"/bin/update_meeting_schedule >>/dev/null 2>&1; :
$
https://www.sf-lug.org/~sflugwww/bin/update_meeting_schedule
And version control:
https://www.sf-lug.org/~sflugwww/bin/RCS/update_meeting_schedule,v

That (obviously?) executes on the hour and half hour all days and hours.
Excessive?  Not really.  At least by default it only updates the web
page if it needs updating, notably isn't showing current schedule.
Also, system default timezone for that host is UTC, not local, so if
were only to check/change at the time meetings end, would need to put a
bit more in there, also, if the host is ever, e.g. down, the more
frequent checks are good to help ensure relatively timely update.

And the program's logic on the schedule, if now is >= end of current
month's meeting, it wants to update the schedule to next month's
meeting, otherwise it wants to use the current month's.

The program looks for and expects a pair of full line tags in the HTML
file, and it preserves those and updates the contents between:
$ PS2=''
$ b='<!-- '
$ a=' managed by update_meeting_schedule -->'
$ curl -s https://www.sf-lug.org/ |
sed -ne "/^${b}START${a}\$/,/^${b}END${a}\$/p"
<!-- START managed by update_meeting_schedule -->
The next meeting is on <b>Sunday January 4th, from 11:00 AM till 1:00
PM</b>, at:<BR>
<!-- END managed by update_meeting_schedule -->
$ PS2='> '
$
Still using exact same format as the earlier PHP output, though that
could be altered by further adjustments to the program that manages that
content.  It already has 4 digit year, 1 and 2 digit versions of month
number and day of month, and day of month in ordinal format all
available (plus some more, and even more could be readily obtained via
date(1), etc.).

As presently configured, the program also expects the mtime on the file
to be more than 25 minutes old, otherwise it won't update it.
Rationale being to reduce probability of clobbering changes to file if
someone might be actively editing it (as may be evidenced by rather
recent mtime).  It also supports options to override some of these
checks, -f ignores the age/freshness of the file, and -F may be used to
write the file if it already has the current schedule.

And the program is basic POSIX shell, and also uses GNU date(1), and
sed(1), and some other small helper programs, but no awk, no perl
(though that was highly tempting), no python.  So, it's not really all
that horribly complex ... especially if considers each of the individual
steps.  Though overall in what it checks and does, there is a fair
amount to it.  Ah, and faketime(1) - very handy for well testing it.

And also gone with the PHP removal, the bit at the bottom of the web
page that indicated when it was last updated - that's also gone.  I
think most really generally don't care about that - it's relative
clutter, and anyone quite wanting to know, can generally ask the server,
e.g.:
$ PS2=''
$ curl -sI https://www.sf-lug.org/ |
sed -ne '/^Last-Modified: /{s/\r$//;p}'
Last-Modified: Tue, 09 Dec 2025 06:08:40 GMT
$ PS2='> '

Anyway, one more thing off of my 6,000+ line (and growing) to do list.

So ... still waiting to hear of all the volunteers clamoring to do
useful stuff for SF-LUG and that are highly capable of such.  Uhm, yeah,
I think of the LUGs I deal with we get about one new volunteer about
every other year, on average.  8-O



More information about the sf-lug mailing list