Upgrade to be able to run on PHp7
This commit is contained in:
parent
b9e04c6ca3
commit
4265af9338
5 changed files with 29 additions and 28 deletions
|
@ -119,7 +119,7 @@ class Katharsis_Db5
|
||||||
public function setDatabase($value)
|
public function setDatabase($value)
|
||||||
{
|
{
|
||||||
$this->_database = $value;
|
$this->_database = $value;
|
||||||
$this->_selectDatabase();
|
// $this->_selectDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,11 +174,11 @@ class Katharsis_Db5
|
||||||
*/
|
*/
|
||||||
public function connect()
|
public function connect()
|
||||||
{
|
{
|
||||||
$this->_connection = mysql_connect(
|
$this->_connection = mysqli_connect(
|
||||||
$this->getHost(),
|
$this->getHost(),
|
||||||
$this->getUser(),
|
$this->getUser(),
|
||||||
$this->getPassword(),
|
$this->getPassword(),
|
||||||
true
|
$this->getDatabase()
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!$this->_connection)
|
if(!$this->_connection)
|
||||||
|
@ -186,7 +186,7 @@ class Katharsis_Db5
|
||||||
throw new KatharsisDb5_Exception('Could not connect to "' . $this->getHost() . '" with user "' . $this->getUser() . '".');
|
throw new KatharsisDb5_Exception('Could not connect to "' . $this->getHost() . '" with user "' . $this->getUser() . '".');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_selectDatabase();
|
// $this->_selectDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +196,7 @@ class Katharsis_Db5
|
||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
$this->_connection = null;
|
$this->_connection = null;
|
||||||
return (bool) mysql_close($this->_connection);
|
return (bool) mysqli_close($this->_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,7 +269,7 @@ class Katharsis_Db5
|
||||||
{
|
{
|
||||||
if(is_string($value))
|
if(is_string($value))
|
||||||
{
|
{
|
||||||
$value = "'" . mysql_real_escape_string($value, $this->_connection) . "'";
|
$value = "'" . mysqli_real_escape_string($value, $this->_connection) . "'";
|
||||||
}
|
}
|
||||||
if($value === null)
|
if($value === null)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,7 @@ class Katharsis_Db5
|
||||||
public function count ($statement)
|
public function count ($statement)
|
||||||
{
|
{
|
||||||
$result = $this->_execute($statement);
|
$result = $this->_execute($statement);
|
||||||
$this->_lastRowCount = mysql_num_rows($result);
|
$this->_lastRowCount = mysqli_num_rows($result);
|
||||||
return $this->_lastRowCount;
|
return $this->_lastRowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,10 +426,10 @@ class Katharsis_Db5
|
||||||
|
|
||||||
if($this->_connection !== null)
|
if($this->_connection !== null)
|
||||||
{
|
{
|
||||||
$value = mysql_real_escape_string($value);
|
$value = mysqli_real_escape_string($this->_connection, $value);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$value = mysql_escape_string($value);
|
$value = mysqli_escape_string($this->_connection, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if string, or a integer, but wanting to request via LIKE
|
// if string, or a integer, but wanting to request via LIKE
|
||||||
|
@ -464,7 +464,7 @@ class Katharsis_Db5
|
||||||
*/
|
*/
|
||||||
public function lastInsertId ()
|
public function lastInsertId ()
|
||||||
{
|
{
|
||||||
return mysql_insert_id($this->_connection);
|
return mysqli_insert_id($this->_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -487,7 +487,7 @@ class Katharsis_Db5
|
||||||
{
|
{
|
||||||
if($this->isConnected() && $this->getDatabase() !== null)
|
if($this->isConnected() && $this->getDatabase() !== null)
|
||||||
{
|
{
|
||||||
if(!mysql_select_db($this->getDatabase(), $this->_connection))
|
if(!mysqli_select_db($this->getDatabase(), $this->_connection))
|
||||||
{
|
{
|
||||||
throw new KatharsisDb5_Exception('Could not select database "' . $this->getDatabase() . '".');
|
throw new KatharsisDb5_Exception('Could not select database "' . $this->getDatabase() . '".');
|
||||||
}
|
}
|
||||||
|
@ -506,16 +506,16 @@ class Katharsis_Db5
|
||||||
{
|
{
|
||||||
throw new KatharsisDb5_Exception("Not connected to database.");
|
throw new KatharsisDb5_Exception("Not connected to database.");
|
||||||
}
|
}
|
||||||
if($result = mysql_query($statement, $this->_connection))
|
if($result = mysqli_query($this->_connection, $statement))
|
||||||
{
|
{
|
||||||
$this->_lastRowCount = mysql_affected_rows($this->_connection);
|
$this->_lastRowCount = mysqli_affected_rows($this->_connection);
|
||||||
}
|
}
|
||||||
$this->_lastStatement = $statement;
|
$this->_lastStatement = $statement;
|
||||||
|
|
||||||
if(mysql_error($this->_connection))
|
if(mysqli_error($this->_connection))
|
||||||
{
|
{
|
||||||
$this->_lastError['number'] = mysql_errno($this->_connection);
|
$this->_lastError['number'] = mysqli_errno($this->_connection);
|
||||||
$this->_lastError['message'] = mysql_error($this->_connection);
|
$this->_lastError['message'] = mysqli_error($this->_connection);
|
||||||
$this->analyseLast();
|
$this->analyseLast();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -549,7 +549,7 @@ class Katharsis_Db5
|
||||||
switch($fetchmode)
|
switch($fetchmode)
|
||||||
{
|
{
|
||||||
case self::FETCHMODE_ASSOC:
|
case self::FETCHMODE_ASSOC:
|
||||||
while($row = mysql_fetch_assoc($result))
|
while($row = mysqli_fetch_assoc($result))
|
||||||
{
|
{
|
||||||
if($fetchOne)
|
if($fetchOne)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +563,7 @@ class Katharsis_Db5
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::FETCHMODE_ARRAY:
|
case self::FETCHMODE_ARRAY:
|
||||||
while($row = mysql_fetch_row($result))
|
while($row = mysqli_fetch_row($result))
|
||||||
{
|
{
|
||||||
if($fetchOne)
|
if($fetchOne)
|
||||||
{
|
{
|
||||||
|
@ -614,11 +614,11 @@ class KatharsisDb5_ResultSet
|
||||||
switch ($fetchmode)
|
switch ($fetchmode)
|
||||||
{
|
{
|
||||||
case Katharsis_Db5::FETCHMODE_ASSOC:
|
case Katharsis_Db5::FETCHMODE_ASSOC:
|
||||||
return mysql_fetch_assoc($this->_resultSet);
|
return mysqli_fetch_assoc($this->_resultSet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Katharsis_Db5::FETCHMODE_ARRAY:
|
case Katharsis_Db5::FETCHMODE_ARRAY:
|
||||||
return mysql_fetch_row($this->_resultSet);
|
return mysqli_fetch_row($this->_resultSet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -13,11 +13,11 @@ require_once('library/Katharsis/Bootstrap.php');
|
||||||
Katharsis_Autoload::init();
|
Katharsis_Autoload::init();
|
||||||
|
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Defaults());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Defaults());
|
||||||
|
Katharsis_Controller_Plugin::registerPlugin(new Local_Controller_Plugin_IndexRedirect());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new Local_Controller_Plugin_PageRewrite());
|
Katharsis_Controller_Plugin::registerPlugin(new Local_Controller_Plugin_PageRewrite());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession());
|
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Notice());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Notice());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new Local_Controller_Plugin_IndexRedirect());
|
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_Autorender());
|
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_Autorender());
|
||||||
|
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Access());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Access());
|
||||||
|
@ -28,6 +28,7 @@ try {
|
||||||
Katharsis_Bootstrap::run();
|
Katharsis_Bootstrap::run();
|
||||||
} catch(Exception $e)
|
} catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
http_response_code(500);
|
||||||
echo '<h2>Exception thrown</h2>';
|
echo '<h2>Exception thrown</h2>';
|
||||||
echo '<h3>' . $e->getMessage() . '</h3>';
|
echo '<h3>' . $e->getMessage() . '</h3>';
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue