Fix installer crashing b/c function was not available.
This commit is contained in:
parent
5bd24c2d12
commit
27d91781ee
@ -6,6 +6,7 @@
|
|||||||
// FIXME: THIS IS A SHIM FOR BACKWARDS COMPATIBILITY - REMOVE WHEN NO LONGER NEEDED
|
// FIXME: THIS IS A SHIM FOR BACKWARDS COMPATIBILITY - REMOVE WHEN NO LONGER NEEDED
|
||||||
|
|
||||||
use Serendipity\Database\DbFactory;
|
use Serendipity\Database\DbFactory;
|
||||||
|
use Serendipity\Database\DbTools;
|
||||||
|
|
||||||
// SQLite3 only fetches by assoc, we will emulate the other result types
|
// SQLite3 only fetches by assoc, we will emulate the other result types
|
||||||
define(SQLITE3_ASSOC, 0);
|
define(SQLITE3_ASSOC, 0);
|
||||||
@ -42,9 +43,7 @@ function serendipity_db_insert($table, $values, $action = 'execute')
|
|||||||
|
|
||||||
function serendipity_db_bool($val)
|
function serendipity_db_bool($val)
|
||||||
{
|
{
|
||||||
global $serendipity;
|
return DbTools::bool($val);
|
||||||
$db = DbFactory::createFromConfig($serendipity);
|
|
||||||
return $db->bool($val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function serendipity_db_get_interval($val, $ival = 900)
|
function serendipity_db_get_interval($val, $ival = 900)
|
||||||
|
@ -229,28 +229,6 @@ abstract class DbAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether an input value corresponds to a TRUE/FALSE option in the SQL database.
|
|
||||||
*
|
|
||||||
* Because older DBs could not store TRUE/FALSE values to be restored into a PHP variable,
|
|
||||||
* this function tries to detect what the return code of a SQL column is, and convert it
|
|
||||||
* to a PHP native boolean.
|
|
||||||
*
|
|
||||||
* Values that will be recognized as TRUE are 'true', 't' and '1'.
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param string input value to compare
|
|
||||||
* @return boolean boolean conversion of the input value
|
|
||||||
*/
|
|
||||||
public function bool($val)
|
|
||||||
{
|
|
||||||
if (($val === true) || ($val == 'true') || ($val == 't') || ($val == '1')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#elseif (($val === false || $val == 'false' || $val == 'f'))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares a Serendipity query input to fully valid SQL. Replaces certain "template" variables.
|
* Prepares a Serendipity query input to fully valid SQL. Replaces certain "template" variables.
|
||||||
*
|
*
|
||||||
|
31
lib/Serendipity/Database/DbTools.php
Normal file
31
lib/Serendipity/Database/DbTools.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Serendipity
|
||||||
|
// See LICENSE file for license information.
|
||||||
|
|
||||||
|
namespace Serendipity\Database;
|
||||||
|
|
||||||
|
class DbTools
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check whether an input value corresponds to a TRUE/FALSE option in the SQL database.
|
||||||
|
*
|
||||||
|
* Because older DBs could not store TRUE/FALSE values to be restored into a PHP variable,
|
||||||
|
* this function tries to detect what the return code of a SQL column is, and convert it
|
||||||
|
* to a PHP native boolean.
|
||||||
|
*
|
||||||
|
* Values that will be recognized as TRUE are 'true', 't' and '1'.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string input value to compare
|
||||||
|
* @return boolean boolean conversion of the input value
|
||||||
|
*/
|
||||||
|
public function bool($val)
|
||||||
|
{
|
||||||
|
if (($val === true) || ($val == 'true') || ($val == 't') || ($val == '1')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#elseif (($val === false || $val == 'false' || $val == 'f'))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user