type fixes

This commit is contained in:
Shish 2019-10-02 09:03:14 +01:00
parent 785e5b67e6
commit 704cab4470
3 changed files with 15 additions and 21 deletions

View file

@ -364,19 +364,10 @@ function insert_defaults()
function build_dirs()
{ // {{{
// *try* and make default dirs. Ignore any errors --
// if something is amiss, we'll tell the user later
if (!file_exists("data")) {
@mkdir("data");
}
if (!is_writable("data")) {
@chmod("data", 0755);
}
$data_exists = file_exists("data") || mkdir("data");
$data_writable = is_writable("data") || chmod("data", 0755);
// Clear file status cache before checking again.
clearstatcache();
if (!file_exists("data") || !is_writable("data")) {
if (!$data_exists || !$data_writable) {
print "
<div id='installer'>
<h1>Shimmie Installer</h1>

View file

@ -203,7 +203,8 @@ class Database
$stmt = $this->db->prepare(
"-- " . str_replace("%2F", "/", urlencode(@$_GET['q'])). "\n" .
$query
);
)
assert(!is_bool($stmt));;
// $stmt = $this->db->prepare($query);
if (!array_key_exists(0, $args)) {
foreach ($args as $name=>$value) {
@ -308,10 +309,12 @@ class Database
public function get_last_insert_id(string $seq): int
{
if ($this->engine->name == DatabaseDriver::PGSQL) {
return $this->db->lastInsertId($seq);
$id = $this->db->lastInsertId($seq);
} else {
return $this->db->lastInsertId();
$id = $this->db->lastInsertId();
}
assert(is_numeric($id));
return (int)$id;
}
/**

View file

@ -225,12 +225,12 @@ abstract class ExtensionInfo
protected function __construct()
{
assert (!empty($this->key), "key field is required");
assert (!empty($this->name), "name field is required for extension $this->key");
assert (empty($this->visibility) || in_array($this->visibility, self::VALID_VISIBILITY), "Invalid visibility for extension $this->key");
assert (is_array($this->db_support), "db_support has to be an array for extension $this->key");
assert (is_array($this->authors), "authors has to be an array for extension $this->key");
assert (is_array($this->dependencies), "dependencies has to be an array for extension $this->key");
assert(!empty($this->key), "key field is required");
assert(!empty($this->name), "name field is required for extension $this->key");
assert(empty($this->visibility) || in_array($this->visibility, self::VALID_VISIBILITY), "Invalid visibility for extension $this->key");
assert(is_array($this->db_support), "db_support has to be an array for extension $this->key");
assert(is_array($this->authors), "authors has to be an array for extension $this->key");
assert(is_array($this->dependencies), "dependencies has to be an array for extension $this->key");
}
public function is_enabled(): bool