Add user maintenance CLI (#9)

- Add CLI infrastructure
- Add user to index page query
- Strip tags from title
- Move item parsing to FeedItem
This commit is contained in:
2024-04-27 13:01:57 -04:00
parent 7b21b86550
commit c1790b58fd
8 changed files with 318 additions and 76 deletions

26
src/cli-start.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
require 'app-config.php';
if (php_sapi_name() != 'cli') {
http_response_code(404);
die('Not Found');
}
/**
* Print a line with a newline character at the end (printf + newline = printfn; surprised this isn't built in!)
*
* @param string $format The format string
* @param mixed ...$values The values for the placeholders in the string
*/
function printfn(string $format, mixed ...$values): void {
printf($format . PHP_EOL, ...$values);
}
/**
* Display a title for a CLI run
*
* @param string $title The title to display on the command line
*/
function cli_title(string $title): void {
printfn("$title | Feed Reader Central v%s" . PHP_EOL, FRC_VERSION);
}