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:
26
src/cli-start.php
Normal file
26
src/cli-start.php
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user