Commit 3252b5ce authored by lphuberdeau's avatar lphuberdeau

[FIX] Issues detecting connection failures in installer, PHP 5.5 compliance

parent f6802b59
......@@ -446,9 +446,9 @@ function list_disable_accounts()
function initTikiDB( &$api, &$driver, $host, $user, $pass, $dbname, $client_charset, &$dbTiki )
{
$initializer = new TikiDb_Initializer;
$initializer->setPreferredConnector($api_tiki);
$initializer->setPreferredConnector($driver);
$initializer->setInitializeCallback(function ($db) {
$db->setServerType($db_tiki);
$db->setServerType('pdo');
$db->setErrorHandler(new InstallerDatabaseErrorHandler);
});
......@@ -462,10 +462,10 @@ function initTikiDB( &$api, &$driver, $host, $user, $pass, $dbname, $client_char
'dbs' => $dbname,
'charset' => $client_charset,
));
$dbcon = ! empty($dbTiki);
} catch (Exception $e) {
$tikifeedback[] = array( 'num' => 1, 'mes' => $e->getMessage() );
}
$dbcon = ! empty($dbTiki);
// Attempt to create database. This might work if the $user has create database permissions.
// First check that suggested database name will not cause issues
......@@ -477,9 +477,9 @@ function initTikiDB( &$api, &$driver, $host, $user, $pass, $dbname, $client_char
$attempt_creation=true;
}
if ( (! $dbcon) && ($attempt_creation == true) ) {
if ( ($dbcon) && ($attempt_creation == true) ) {
$sql="CREATE DATABASE IF NOT EXISTS `$dbname_clean` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
$dbTiki->query($sql, $error);
$dbTiki->queryError($sql, $error);
if ( empty($error) ) {
$tikifeedback[] = array( 'num' => 1, 'mes'=> tra("Database `%0` was created.", '', false, array($dbname_clean)) );
} else {
......
......@@ -21,7 +21,7 @@ class TikiDb_Initializer_Pdo
// you can only use one method to connect, not both. If $socket_tiki
// is set in local.php, then it will override the hostname method
// of connecting to the database.
if ($credentials['socket']) {
if (! empty($credentials['socket'])) {
$db_hoststring = "unix_socket={$credentials['socket']}";
}
......
......@@ -132,18 +132,18 @@ class Tracker_Field_File extends Tracker_Field_Abstract
);
}
function getDocumentPart($baseKey, Search_Type_Factory_Interface $typeFactory)
function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
return array(
);
}
function getProvidedFields($baseKey)
function getProvidedFields()
{
return array();
}
function getGlobalFields($baseKey)
function getGlobalFields()
{
return array();
}
......
......@@ -155,7 +155,7 @@ class Tracker_Field_Rating extends Tracker_Field_Abstract
);
}
function getGlobalFields($baseKey)
function getGlobalFields()
{
return array();
}
......
......@@ -26,6 +26,7 @@
class ParserLib extends TikiDb_Bridge
{
private $makeTocCount = 0;
private $pre_handlers = array();
private $pos_handlers = array();
private $postedit_handlers = array();
......
......@@ -70,7 +70,7 @@ class Reports_CacheTest extends TikiDatabaseTestCase
$cacheData = array('event' => 'wiki_page_changed');
$this->obj->add(&$watches, $cacheData, $users);
$this->obj->add($watches, $cacheData, $users);
$queryTable = $this->getConnection()->createQueryTable('tiki_user_reports_cache', 'SELECT * FROM tiki_user_reports_cache');
......@@ -78,4 +78,4 @@ class Reports_CacheTest extends TikiDatabaseTestCase
$this->assertEquals($expectedResult, $watches);
}
}
\ No newline at end of file
}
......@@ -209,7 +209,11 @@
<br>
{section name=n loop=$tikifeedback}
<div class="simplebox {if $tikifeedback[n].num > 0} highlight{/if}">
<img src="img/icons/{if $tikifeedback[n].num > 0}delete.png" alt="{tr}Error{/tr}"{else}accept.png" alt="{tr}Success{/tr}"{/if} style="vertical-align:middle"> {$tikifeedback[n].mes}
{if $tikifeedback[n].num > 0}
<img src="img/icons/delete.png" alt="{tr}Error{/tr}" style="vertical-align:middle"> {$tikifeedback[n].mes}
{else}
<img src="img/icons/accept.png" alt="{tr}Success{/tr}" style="vertical-align:middle"> {$tikifeedback[n].mes}
{/if}
</div>
{/section}
{/if}
......
......@@ -58,9 +58,9 @@ $quiz = $quizlib->quiz_fetch($_REQUEST["quizId"]);
* @param $_REQUEST
* @param $option
*/
function fetchYNOption(&$quiz, $_REQUEST, $option)
function fetchYNOption(&$quiz, $request, $option)
{
if (isset($_REQUEST[$option]) && $_REQUEST[$option] == 'on') {
if (isset($request[$option]) && $request[$option] == 'on') {
$quiz[$option] = 'y';
} else {
$quiz[$option] = 'n';
......
......@@ -1181,7 +1181,7 @@ class Auth_OpenID_GenericConsumer {
// oidutil.log('Performing discovery on %s' % (claimed_id,))
list($unused, $services) = call_user_func($this->discoverMethod,
$claimed_id,
&$this->fetcher);
$this->fetcher);
if (!$services) {
return new Auth_OpenID_FailureResponse(null,
......
......@@ -1704,7 +1704,7 @@ class Auth_OpenID_Server {
{
if (method_exists($this, "openid_" . $request->mode)) {
$handler = array($this, "openid_" . $request->mode);
return call_user_func($handler, &$request);
return call_user_func($handler, $request);
}
return null;
}
......
......@@ -413,7 +413,7 @@ class Auth_Yadis_Discovery {
list($yadis_url, $services) = call_user_func($discover_cb,
$this->url,
&$fetcher);
$fetcher);
$manager = $this->createManager($services, $yadis_url);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment