Show an error message when the sqlite database is readonly (#427)

This commit is contained in:
onli 2020-05-28 14:07:36 +02:00
parent 40bae4f5b2
commit 0ad7691634
2 changed files with 14 additions and 0 deletions

View File

@ -129,6 +129,16 @@ if ($entriesAmount < (int)$serendipity['dashboardEntriesLimit']) {
}
}
$dbHealth = true;
if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') {
// we check that the database is writeable, because that's otherwise hard to detect for users
$dbFile = $serendipity['serendipityPath'] . $serendipity['dbName'] . '.db';
$dbHealth = is_writable($dbFile);
}
$data['db_health'] = $dbHealth;
$data['entries'] = $entries;
$data['urltoken'] = serendipity_setFormToken('url');

View File

@ -2,6 +2,10 @@
<h2>{$CONST.WELCOME_BACK} {$username|escape}</h2>
<a href="#s9y_links" class="button_link toggle_links"><span class="icon-info-circled" aria-hidden="true"></span><span class="visuallyhidden"> {$CONST.FURTHER_LINKS}</span></a>
</div>
{if NOT $db_health}
<span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> Error, database not writeable</span>
<hr class="separator">
{/if}
{$backend_frontpage_display}
<div id="dashboard">
{if $published}