Merge branch '3.8'

Conflicts:
	lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php
	lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php
	lib/classes/connection.php
	lib/classes/connection/abstract.php
	lib/classes/connection/interface.php
	lib/classes/connection/pdo.php
	lib/classes/connection/pdoStatementDebugger.php
	lib/classes/module/report/activity.php
	lib/classes/module/report/sqlfilter.php
	lib/classes/record/adapter.php
	lib/classes/task/period/subdef.php
	templates/web/prod/thesaurus.js.twig
	tests/Alchemy/Tests/Phrasea/Setup/InstallerTest.php
	tests/classes/PhraseanetPHPUnitAbstract.php
	tests/classes/connectionTest.php
This commit is contained in:
Nicolas Le Goff
2014-09-02 19:09:38 +02:00
13 changed files with 323 additions and 145 deletions

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class connection_pdoStatement implements \connection_statement
{
protected $statement;
public function __construct(\PDOStatement $statement)
{
$this->statement = $statement;
return $this;
}
public function getQueryString()
{
return $this->statement->queryString;
}
public function execute($params = array())
{
return $this->statement->execute($params);
}
public function __call($function_name, $parameters)
{
return call_user_func_array(array($this->statement, $function_name), $parameters);
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class connection_pdoStatementReconnectable implements \connection_statement
{
protected $queryString;
protected $statement;
protected $conn;
public function __construct(\connection_statement $statement, \connection_pdo $conn)
{
$this->statement = $statement;
$this->conn = $conn;
return $this;
}
public function getQueryString()
{
return $this->statement->getQueryString();
}
public function execute($params = array())
{
try {
return $this->statement->execute($params);
} catch (\Exception $e) {
$unreachable = ($e->getCode() === 2006) || (false !== strpos($e->getMessage(), 'MySQL server has gone away')) || (false !== strpos($e->getMessage(), 'errno=32 Broken pipe'));
if (!$unreachable) {
throw $e;
}
$this->conn->connect();
}
// retry query with update statement
$this->statement = $this->conn->prepare($this->getQueryString());
return $this->statement->execute($params);
}
public function __call($function_name, $parameters)
{
return call_user_func_array(array($this->statement, $function_name), $parameters);
}
}

View File

@@ -0,0 +1,16 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
interface connection_statement
{
public function execute($params = array());
public function getQueryString();
}