installer.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * Installation lib
  18. *
  19. * @package Installation
  20. * @author Adrian Lang <mail@adrianlang.de>
  21. * @author Brenda Wallace <shiny@cpan.org>
  22. * @author Brett Taylor <brett@webfroot.co.nz>
  23. * @author Brion Vibber <brion@pobox.com>
  24. * @author CiaranG <ciaran@ciarang.com>
  25. * @author Craig Andrews <candrews@integralblue.com>
  26. * @author Eric Helgeson <helfire@Erics-MBP.local>
  27. * @author Evan Prodromou <evan@status.net>
  28. * @author Mikael Nordfeldth <mmn@hethane.se>
  29. * @author Robin Millette <millette@controlyourself.ca>
  30. * @author Sarven Capadisli <csarven@status.net>
  31. * @author Tom Adams <tom@holizz.com>
  32. * @author Zach Copley <zach@status.net>
  33. * @author Diogo Cordeiro <diogo@fc.up.pt>
  34. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
  35. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  36. */
  37. abstract class Installer
  38. {
  39. /** Web site info */
  40. public $sitename;
  41. public $server;
  42. public $path;
  43. public $fancy;
  44. public $siteProfile;
  45. public $ssl;
  46. /** DB info */
  47. public $host;
  48. public $database;
  49. public $dbtype;
  50. public $username;
  51. public $password;
  52. public $db;
  53. /** Storage info */
  54. public $avatarDir;
  55. public $fileDir;
  56. /** Administrator info */
  57. public $adminNick;
  58. public $adminPass;
  59. public $adminEmail;
  60. /** Should we skip writing the configuration file? */
  61. public $skipConfig = false;
  62. public static $dbModules = [
  63. 'mysql' => [
  64. 'name' => 'MariaDB 10.3+',
  65. 'check_module' => 'mysqli',
  66. 'scheme' => 'mysqli', // DSN prefix for PEAR::DB
  67. ],
  68. 'pgsql' => [
  69. 'name' => 'PostgreSQL 11+',
  70. 'check_module' => 'pgsql',
  71. 'scheme' => 'pgsql', // DSN prefix for PEAR::DB
  72. ]
  73. ];
  74. /**
  75. * Attempt to include a PHP file and report if it worked, while
  76. * suppressing the annoying warning messages on failure.
  77. * @param string $filename
  78. * @return bool
  79. */
  80. private function haveIncludeFile(string $filename): bool
  81. {
  82. $old = error_reporting(error_reporting() & ~E_WARNING);
  83. $ok = include_once($filename);
  84. error_reporting($old);
  85. return $ok;
  86. }
  87. /**
  88. * Check if all is ready for installation
  89. *
  90. * @return bool
  91. */
  92. public function checkPrereqs(): bool
  93. {
  94. $pass = true;
  95. $config = INSTALLDIR . '/config.php';
  96. if (!$this->skipConfig && file_exists($config)) {
  97. if (!is_writable($config) || filesize($config) > 0) {
  98. if (filesize($config) == 0) {
  99. $this->warning('Config file "config.php" already exists and is empty, but is not writable.');
  100. } else {
  101. $this->warning('Config file "config.php" already exists.');
  102. }
  103. $pass = false;
  104. }
  105. }
  106. if (version_compare(PHP_VERSION, '7.3.0', '<')) {
  107. $this->warning('Require PHP version 7.3.0 or greater.');
  108. $pass = false;
  109. }
  110. $reqs = ['bcmath', 'curl', 'dom', 'gd', 'intl', 'json', 'mbstring', 'openssl', 'simplexml', 'xml', 'xmlwriter'];
  111. foreach ($reqs as $req) {
  112. // Checks if a php extension is both installed and loaded
  113. if (!extension_loaded($req)) {
  114. $this->warning(sprintf('Cannot load required extension: <code>%s</code>', $req));
  115. $pass = false;
  116. }
  117. }
  118. // Make sure we have at least one database module available
  119. $missingExtensions = [];
  120. foreach (self::$dbModules as $type => $info) {
  121. if (!extension_loaded($info['check_module'])) {
  122. $missingExtensions[] = $info['check_module'];
  123. }
  124. }
  125. if (count($missingExtensions) == count(self::$dbModules)) {
  126. $req = implode(', ', $missingExtensions);
  127. $this->warning(sprintf('Cannot find a database extension. You need at least one of %s.', $req));
  128. $pass = false;
  129. }
  130. // @fixme this check seems to be insufficient with Windows ACLs
  131. if (!$this->skipConfig && !is_writable(INSTALLDIR)) {
  132. $this->warning(
  133. sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR),
  134. sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR)
  135. );
  136. $pass = false;
  137. }
  138. // Check the subdirs used for file uploads
  139. // TODO get another flag for this --skipFileSubdirCreation
  140. if (!$this->skipConfig) {
  141. define('GNUSOCIAL', true);
  142. define('STATUSNET', true);
  143. require_once INSTALLDIR . '/lib/util/language.php';
  144. $_server = $this->server;
  145. $_path = $this->path; // We won't be using those so it's safe to do this small hack
  146. require_once INSTALLDIR . '/lib/util/util.php';
  147. require_once INSTALLDIR . '/lib/util/default.php';
  148. $fileSubdirs = [
  149. empty($this->avatarDir) ? $default['avatar']['dir'] : $this->avatarDir,
  150. empty($this->fileDir) ? $default['attachments']['dir'] : $this->fileDir
  151. ];
  152. unset($default);
  153. foreach ($fileSubdirs as $fileFullPath) {
  154. if (!file_exists($fileFullPath)) {
  155. $this->warning(
  156. sprintf('GNU social was unable to create a directory on this path: %s', $fileFullPath),
  157. 'Either create that directory with the right permissions so that GNU social can use it or '.
  158. 'set the necessary permissions and it will be created.'
  159. );
  160. $pass = $pass && mkdir($fileFullPath);
  161. } elseif (!is_dir($fileFullPath)) {
  162. $this->warning(
  163. sprintf('GNU social expected a directory but found something else on this path: %s', $fileFullPath),
  164. 'Either make sure it goes to a directory or remove it and a directory will be created.'
  165. );
  166. $pass = false;
  167. } elseif (!is_writable($fileFullPath)) {
  168. $this->warning(
  169. sprintf('Cannot write to directory: <code>%s</code>', $fileFullPath),
  170. sprintf('On your server, try this command: <code>chmod a+w %s</code>', $fileFullPath)
  171. );
  172. $pass = false;
  173. }
  174. }
  175. }
  176. return $pass;
  177. }
  178. /**
  179. * Basic validation on the database parameters
  180. * Side effects: error output if not valid
  181. *
  182. * @return bool success
  183. */
  184. public function validateDb(): bool
  185. {
  186. $fail = false;
  187. if (empty($this->host)) {
  188. $this->updateStatus("No hostname specified.", true);
  189. $fail = true;
  190. }
  191. if (empty($this->database)) {
  192. $this->updateStatus("No database specified.", true);
  193. $fail = true;
  194. }
  195. if (empty($this->username)) {
  196. $this->updateStatus("No username specified.", true);
  197. $fail = true;
  198. }
  199. if (empty($this->sitename)) {
  200. $this->updateStatus("No sitename specified.", true);
  201. $fail = true;
  202. }
  203. return !$fail;
  204. }
  205. /**
  206. * Basic validation on the administrator user parameters
  207. * Side effects: error output if not valid
  208. *
  209. * @return bool success
  210. */
  211. public function validateAdmin(): bool
  212. {
  213. $fail = false;
  214. if (empty($this->adminNick)) {
  215. $this->updateStatus("No initial user nickname specified.", true);
  216. $fail = true;
  217. }
  218. if ($this->adminNick && !preg_match('/^[0-9a-z]{1,64}$/', $this->adminNick)) {
  219. $this->updateStatus('The user nickname "' . htmlspecialchars($this->adminNick) .
  220. '" is invalid; should be plain letters and numbers no longer than 64 characters.', true);
  221. $fail = true;
  222. }
  223. // @fixme hardcoded list; should use Nickname::isValid()
  224. // if/when it's safe to have loaded the infrastructure here
  225. $blacklist = ['main', 'panel', 'twitter', 'settings', 'rsd.xml', 'favorited', 'featured', 'favoritedrss', 'featuredrss', 'rss', 'getfile', 'api', 'groups', 'group', 'peopletag', 'tag', 'user', 'message', 'conversation', 'notice', 'attachment', 'search', 'index.php', 'doc', 'opensearch', 'robots.txt', 'xd_receiver.html', 'facebook', 'activity'];
  226. if (in_array($this->adminNick, $blacklist)) {
  227. $this->updateStatus('The user nickname "' . htmlspecialchars($this->adminNick) .
  228. '" is reserved.', true);
  229. $fail = true;
  230. }
  231. if (empty($this->adminPass)) {
  232. $this->updateStatus("No initial user password specified.", true);
  233. $fail = true;
  234. }
  235. return !$fail;
  236. }
  237. /**
  238. * Make sure a site profile was selected
  239. *
  240. * @return bool success
  241. */
  242. public function validateSiteProfile(): bool
  243. {
  244. if (empty($this->siteProfile)) {
  245. $this->updateStatus("No site profile selected.", true);
  246. return false;
  247. }
  248. return true;
  249. }
  250. /**
  251. * Set up the database with the appropriate function for the selected type...
  252. * Saves database info into $this->db.
  253. *
  254. * @fixme escape things in the connection string in case we have a funny pass etc
  255. * @return mixed array of database connection params on success, false on failure
  256. * @throws Exception
  257. */
  258. public function setupDatabase()
  259. {
  260. if ($this->db) {
  261. throw new Exception("Bad order of operations: DB already set up.");
  262. }
  263. $this->updateStatus("Starting installation...");
  264. if (empty($this->password)) {
  265. $auth = '';
  266. } else {
  267. $auth = ":$this->password";
  268. }
  269. $scheme = self::$dbModules[$this->dbtype]['scheme'];
  270. $dsn = "{$scheme}://{$this->username}{$auth}@{$this->host}/{$this->database}";
  271. $this->updateStatus("Checking database...");
  272. $conn = $this->connectDatabase($dsn);
  273. if (!$conn instanceof DB_common) {
  274. // Is not the right instance
  275. throw new Exception('Cannot connect to database: ' . $conn->getMessage());
  276. }
  277. switch ($this->dbtype) {
  278. case 'pgsql':
  279. // ensure the database encoding is UTF8
  280. $conn->query("SET NAMES 'UTF8'");
  281. $server_encoding = $conn->getRow('SHOW server_encoding')[0];
  282. if ($server_encoding !== 'UTF8') {
  283. $this->updateStatus(
  284. 'GNU social requires the UTF8 character encoding. Yours is ' .
  285. htmlentities($server_encoding)
  286. );
  287. return false;
  288. }
  289. break;
  290. case 'mysql':
  291. // ensure the database encoding is utf8mb4
  292. $conn->query("SET NAMES 'utf8mb4'");
  293. $server_encoding = $conn->getRow("SHOW VARIABLES LIKE 'character_set_server'")[1];
  294. if ($server_encoding !== 'utf8mb4') {
  295. $this->updateStatus(
  296. 'GNU social requires the utf8mb4 character encoding. Yours is ' .
  297. htmlentities($server_encoding)
  298. );
  299. return false;
  300. }
  301. break;
  302. default:
  303. $this->updateStatus('Unknown DB type selected: ' . $this->dbtype);
  304. return false;
  305. }
  306. $res = $this->updateStatus("Creating database tables...");
  307. if (!$this->createCoreTables($conn)) {
  308. $this->updateStatus("Error creating tables.", true);
  309. return false;
  310. }
  311. foreach (['sms_carrier' => 'SMS carrier',
  312. 'notice_source' => 'notice source',
  313. 'foreign_services' => 'foreign service']
  314. as $scr => $name) {
  315. $this->updateStatus(sprintf("Adding %s data to database...", $name));
  316. $res = $this->runDbScript($scr . '.sql', $conn);
  317. if ($res === false) {
  318. $this->updateStatus(sprintf("Can't run %s script.", $name), true);
  319. return false;
  320. }
  321. }
  322. $db = ['type' => $this->dbtype, 'database' => $dsn];
  323. return $db;
  324. }
  325. /**
  326. * Open a connection to the database.
  327. *
  328. * @param string $dsn
  329. * @return DB|DB_Error
  330. */
  331. public function connectDatabase(string $dsn)
  332. {
  333. global $_DB;
  334. return $_DB->connect($dsn);
  335. }
  336. /**
  337. * Create core tables on the given database connection.
  338. *
  339. * @param DB_common $conn
  340. * @return bool
  341. */
  342. public function createCoreTables(DB_common $conn): bool
  343. {
  344. $schema = Schema::get($conn, $this->dbtype);
  345. $tableDefs = $this->getCoreSchema();
  346. foreach ($tableDefs as $name => $def) {
  347. if (defined('DEBUG_INSTALLER')) {
  348. echo " $name ";
  349. }
  350. $schema->ensureTable($name, $def);
  351. }
  352. return true;
  353. }
  354. /**
  355. * Fetch the core table schema definitions.
  356. *
  357. * @return array of table names => table def arrays
  358. */
  359. public function getCoreSchema(): array
  360. {
  361. $schema = [];
  362. include INSTALLDIR . '/db/core.php';
  363. return $schema;
  364. }
  365. /**
  366. * Return a parseable PHP literal for the given value.
  367. * This will include quotes for strings, etc.
  368. *
  369. * @param mixed $val
  370. * @return string
  371. */
  372. public function phpVal($val): string
  373. {
  374. return var_export($val, true);
  375. }
  376. /**
  377. * Return an array of parseable PHP literal for the given values.
  378. * These will include quotes for strings, etc.
  379. *
  380. * @param mixed $map
  381. * @return array
  382. */
  383. public function phpVals($map): array
  384. {
  385. return array_map([$this, 'phpVal'], $map);
  386. }
  387. /**
  388. * Write a stock configuration file.
  389. *
  390. * @return bool success
  391. *
  392. * @fixme escape variables in output in case we have funny chars, apostrophes etc
  393. */
  394. public function writeConf(): bool
  395. {
  396. $vals = $this->phpVals([
  397. 'sitename' => $this->sitename,
  398. 'server' => $this->server,
  399. 'path' => $this->path,
  400. 'ssl' => in_array($this->ssl, ['never', 'always'])
  401. ? $this->ssl
  402. : 'never',
  403. 'db_database' => $this->db['database'],
  404. 'db_type' => $this->db['type']
  405. ]);
  406. // assemble configuration file in a string
  407. $cfg = "<?php\n" .
  408. "if (!defined('GNUSOCIAL')) { exit(1); }\n\n" .
  409. // site name
  410. "\$config['site']['name'] = {$vals['sitename']};\n\n" .
  411. // site location
  412. "\$config['site']['server'] = {$vals['server']};\n" .
  413. "\$config['site']['path'] = {$vals['path']}; \n\n" .
  414. "\$config['site']['ssl'] = {$vals['ssl']}; \n\n" .
  415. // checks if fancy URLs are enabled
  416. ($this->fancy ? "\$config['site']['fancy'] = true;\n\n" : '') .
  417. // database
  418. "\$config['db']['database'] = {$vals['db_database']};\n\n" .
  419. "\$config['db']['type'] = {$vals['db_type']};\n\n" .
  420. "// Uncomment below for better performance. Just remember you must run\n" .
  421. "// php scripts/checkschema.php whenever your enabled plugins change!\n" .
  422. "//\$config['db']['schemacheck'] = 'script';\n\n";
  423. // Normalize line endings for Windows servers
  424. $cfg = str_replace("\n", PHP_EOL, $cfg);
  425. // write configuration file out to install directory
  426. $res = file_put_contents(INSTALLDIR . DIRECTORY_SEPARATOR . 'config.php', $cfg);
  427. return $res;
  428. }
  429. /**
  430. * Write the site profile. We do this after creating the initial user
  431. * in case the site profile is set to single user. This gets around the
  432. * 'chicken-and-egg' problem of the system requiring a valid user for
  433. * single user mode, before the intial user is actually created. Yeah,
  434. * we should probably do this in smarter way.
  435. *
  436. * @return int res number of bytes written
  437. */
  438. public function writeSiteProfile(): int
  439. {
  440. $vals = $this->phpVals([
  441. 'site_profile' => $this->siteProfile,
  442. 'nickname' => $this->adminNick
  443. ]);
  444. $cfg =
  445. // site profile
  446. "\$config['site']['profile'] = {$vals['site_profile']};\n";
  447. if ($this->siteProfile == "singleuser") {
  448. $cfg .= "\$config['singleuser']['nickname'] = {$vals['nickname']};\n\n";
  449. } else {
  450. $cfg .= "\n";
  451. }
  452. // Normalize line endings for Windows servers
  453. $cfg = str_replace("\n", PHP_EOL, $cfg);
  454. // write configuration file out to install directory
  455. $res = file_put_contents(INSTALLDIR . '/config.php', $cfg, FILE_APPEND);
  456. return $res;
  457. }
  458. /**
  459. * Install schema into the database
  460. *
  461. * @param string $filename location of database schema file
  462. * @param DB_common $conn connection to database
  463. *
  464. * @return bool - indicating success or failure
  465. */
  466. public function runDbScript(string $filename, DB_common $conn): bool
  467. {
  468. $sql = trim(file_get_contents(INSTALLDIR . '/db/' . $filename));
  469. $stmts = explode(';', $sql);
  470. foreach ($stmts as $stmt) {
  471. $stmt = trim($stmt);
  472. if (!mb_strlen($stmt)) {
  473. continue;
  474. }
  475. try {
  476. $res = $conn->query($stmt);
  477. } catch (Exception $e) {
  478. $error = $e->getMessage();
  479. $this->updateStatus("ERROR ($error) for SQL '$stmt'");
  480. return false;
  481. }
  482. }
  483. return true;
  484. }
  485. /**
  486. * Create the initial admin user account.
  487. * Side effect: may load portions of GNU social framework.
  488. * Side effect: outputs program info
  489. */
  490. public function registerInitialUser(): bool
  491. {
  492. // initalize hostname from install arguments, so it can be used to find
  493. // the /etc config file from the commandline installer
  494. $server = $this->server;
  495. require_once INSTALLDIR . '/lib/util/common.php';
  496. $data = ['nickname' => $this->adminNick,
  497. 'password' => $this->adminPass,
  498. 'fullname' => $this->adminNick];
  499. if ($this->adminEmail) {
  500. $data['email'] = $this->adminEmail;
  501. }
  502. try {
  503. $user = User::register($data, true); // true to skip email sending verification
  504. } catch (Exception $e) {
  505. return false;
  506. }
  507. // give initial user carte blanche
  508. $user->grantRole('owner');
  509. $user->grantRole('moderator');
  510. $user->grantRole('administrator');
  511. return true;
  512. }
  513. /**
  514. * The beef of the installer!
  515. * Create database, config file, and admin user.
  516. *
  517. * Prerequisites: validation of input data.
  518. *
  519. * @return bool success
  520. */
  521. public function doInstall(): bool
  522. {
  523. global $config;
  524. $this->updateStatus("Initializing...");
  525. ini_set('display_errors', 1);
  526. error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
  527. if (!defined('GNUSOCIAL')) {
  528. define('GNUSOCIAL', true);
  529. }
  530. if (!defined('STATUSNET')) {
  531. define('STATUSNET', true);
  532. }
  533. require_once INSTALLDIR . '/lib/util/framework.php';
  534. GNUsocial::initDefaults($this->server, $this->path);
  535. if ($this->siteProfile == "singleuser") {
  536. // Until we use ['site']['profile']==='singleuser' everywhere
  537. $config['singleuser']['enabled'] = true;
  538. }
  539. try {
  540. $this->db = $this->setupDatabase();
  541. if (!$this->db) {
  542. // database connection failed, do not move on to create config file.
  543. return false;
  544. }
  545. } catch (Exception $e) {
  546. // Lower-level DB error!
  547. $this->updateStatus("Database error: " . $e->getMessage(), true);
  548. return false;
  549. }
  550. if (!$this->skipConfig) {
  551. // Make sure we can write to the file twice
  552. $oldUmask = umask(000);
  553. $this->updateStatus("Writing config file...");
  554. $res = $this->writeConf();
  555. if (!$res) {
  556. $this->updateStatus("Can't write config file.", true);
  557. return false;
  558. }
  559. }
  560. if (!empty($this->adminNick)) {
  561. // Okay, cross fingers and try to register an initial user
  562. if ($this->registerInitialUser()) {
  563. $this->updateStatus(
  564. "An initial user with the administrator role has been created."
  565. );
  566. } else {
  567. $this->updateStatus(
  568. "Could not create initial user account.",
  569. true
  570. );
  571. return false;
  572. }
  573. }
  574. if (!$this->skipConfig) {
  575. $this->updateStatus("Setting site profile...");
  576. $res = $this->writeSiteProfile();
  577. if (!$res) {
  578. $this->updateStatus("Can't write to config file.", true);
  579. return false;
  580. }
  581. // Restore original umask
  582. umask($oldUmask);
  583. // Set permissions back to something decent
  584. chmod(INSTALLDIR . '/config.php', 0644);
  585. }
  586. $scheme = $this->ssl === 'always' ? 'https' : 'http';
  587. $link = "{$scheme}://{$this->server}/{$this->path}";
  588. $this->updateStatus("GNU social has been installed at $link");
  589. $this->updateStatus(
  590. '<strong>DONE!</strong> You can visit your <a href="' . htmlspecialchars($link) . '">new GNU social site</a> (log in as "' . htmlspecialchars($this->adminNick) . '"). If this is your first GNU social install, make your experience the best possible by visiting our resource site to join the <a href="https://gnu.io/social/resources/">mailing list or IRC</a>. <a href="' . htmlspecialchars($link) . '/doc/faq">FAQ is found here</a>.'
  591. );
  592. return true;
  593. }
  594. /**
  595. * Output a pre-install-time warning message
  596. * @param string $message HTML ok, but should be plaintext-able
  597. * @param string $submessage HTML ok, but should be plaintext-able
  598. */
  599. abstract public function warning(string $message, string $submessage = '');
  600. /**
  601. * Output an install-time progress message
  602. * @param string $status HTML ok, but should be plaintext-able
  603. * @param bool $error true if this should be marked as an error condition
  604. */
  605. abstract public function updateStatus(string $status, bool $error = false);
  606. }