type fixes
This commit is contained in:
parent
785e5b67e6
commit
704cab4470
3 changed files with 15 additions and 21 deletions
|
@ -364,19 +364,10 @@ function insert_defaults()
|
||||||
|
|
||||||
function build_dirs()
|
function build_dirs()
|
||||||
{ // {{{
|
{ // {{{
|
||||||
// *try* and make default dirs. Ignore any errors --
|
$data_exists = file_exists("data") || mkdir("data");
|
||||||
// if something is amiss, we'll tell the user later
|
$data_writable = is_writable("data") || chmod("data", 0755);
|
||||||
if (!file_exists("data")) {
|
|
||||||
@mkdir("data");
|
|
||||||
}
|
|
||||||
if (!is_writable("data")) {
|
|
||||||
@chmod("data", 0755);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear file status cache before checking again.
|
if (!$data_exists || !$data_writable) {
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
if (!file_exists("data") || !is_writable("data")) {
|
|
||||||
print "
|
print "
|
||||||
<div id='installer'>
|
<div id='installer'>
|
||||||
<h1>Shimmie Installer</h1>
|
<h1>Shimmie Installer</h1>
|
||||||
|
|
|
@ -203,7 +203,8 @@ class Database
|
||||||
$stmt = $this->db->prepare(
|
$stmt = $this->db->prepare(
|
||||||
"-- " . str_replace("%2F", "/", urlencode(@$_GET['q'])). "\n" .
|
"-- " . str_replace("%2F", "/", urlencode(@$_GET['q'])). "\n" .
|
||||||
$query
|
$query
|
||||||
);
|
)
|
||||||
|
assert(!is_bool($stmt));;
|
||||||
// $stmt = $this->db->prepare($query);
|
// $stmt = $this->db->prepare($query);
|
||||||
if (!array_key_exists(0, $args)) {
|
if (!array_key_exists(0, $args)) {
|
||||||
foreach ($args as $name=>$value) {
|
foreach ($args as $name=>$value) {
|
||||||
|
@ -308,10 +309,12 @@ class Database
|
||||||
public function get_last_insert_id(string $seq): int
|
public function get_last_insert_id(string $seq): int
|
||||||
{
|
{
|
||||||
if ($this->engine->name == DatabaseDriver::PGSQL) {
|
if ($this->engine->name == DatabaseDriver::PGSQL) {
|
||||||
return $this->db->lastInsertId($seq);
|
$id = $this->db->lastInsertId($seq);
|
||||||
} else {
|
} else {
|
||||||
return $this->db->lastInsertId();
|
$id = $this->db->lastInsertId();
|
||||||
}
|
}
|
||||||
|
assert(is_numeric($id));
|
||||||
|
return (int)$id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -225,12 +225,12 @@ abstract class ExtensionInfo
|
||||||
|
|
||||||
protected function __construct()
|
protected function __construct()
|
||||||
{
|
{
|
||||||
assert (!empty($this->key), "key field is required");
|
assert(!empty($this->key), "key field is required");
|
||||||
assert (!empty($this->name), "name field is required for extension $this->key");
|
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(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->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->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(is_array($this->dependencies), "dependencies has to be an array for extension $this->key");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_enabled(): bool
|
public function is_enabled(): bool
|
||||||
|
|
Reference in a new issue