diff --git a/core/lib/Drupal/Component/Archiver/ArchiveTar.php b/core/lib/Drupal/Component/Archiver/ArchiveTar.php
index 4a8d828..a0ffb53 100644
--- a/core/lib/Drupal/Component/Archiver/ArchiveTar.php
+++ b/core/lib/Drupal/Component/Archiver/ArchiveTar.php
@@ -42,8 +42,6 @@
namespace Drupal\Component\Archiver;
-use Exception;
-
//require_once 'PEAR.php';
//
//
@@ -636,7 +634,7 @@ class ArchiveTar // extends PEAR
{
// ----- To be completed
// $this->raiseError($p_message);
- throw new Exception($p_message);
+ throw new \Exception($p_message);
}
// }}}
@@ -645,7 +643,7 @@ class ArchiveTar // extends PEAR
{
// ----- To be completed
// $this->raiseError($p_message);
- throw new Exception($p_message);
+ throw new \Exception($p_message);
}
// }}}
diff --git a/core/lib/Drupal/Component/Archiver/ArchiverException.php b/core/lib/Drupal/Component/Archiver/ArchiverException.php
index 12af470..abf7325 100644
--- a/core/lib/Drupal/Component/Archiver/ArchiverException.php
+++ b/core/lib/Drupal/Component/Archiver/ArchiverException.php
@@ -7,10 +7,8 @@
namespace Drupal\Component\Archiver;
-use Exception;
-
/**
* Defines an exception class for Drupal\Component\Archiver\ArchiverInterface.
*/
-class ArchiverException extends Exception {
+class ArchiverException extends \Exception {
}
diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
index 9416548..69b1a49 100644
--- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php
+++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
@@ -7,8 +7,6 @@
namespace Drupal\Core\Cache;
-use Exception;
-
/**
* Defines a default cache implementation.
*
@@ -74,7 +72,7 @@ class DatabaseBackend implements CacheBackendInterface {
$cids = array_diff($cids, array_keys($cache));
return $cache;
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// If the database is never going to be available, cache requests should
// return FALSE in order to allow exception handling to occur.
return array();
@@ -152,7 +150,7 @@ class DatabaseBackend implements CacheBackendInterface {
->fields($fields)
->execute();
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// The database may not be available, so we'll ignore cache_set requests.
}
}
diff --git a/core/lib/Drupal/Core/Cache/InstallBackend.php b/core/lib/Drupal/Core/Cache/InstallBackend.php
index b527d56..cf84c64 100644
--- a/core/lib/Drupal/Core/Cache/InstallBackend.php
+++ b/core/lib/Drupal/Core/Cache/InstallBackend.php
@@ -7,8 +7,6 @@
namespace Drupal\Core\Cache;
-use Exception;
-
/**
* Defines a stub cache implementation to be used during installation.
*
@@ -61,7 +59,7 @@ class InstallBackend extends DatabaseBackend {
parent::delete($cid);
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -73,7 +71,7 @@ class InstallBackend extends DatabaseBackend {
parent::deleteMultiple($cids);
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -85,7 +83,7 @@ class InstallBackend extends DatabaseBackend {
parent::deletePrefix($prefix);
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -97,7 +95,7 @@ class InstallBackend extends DatabaseBackend {
parent::invalidateTags($tags);
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -109,7 +107,7 @@ class InstallBackend extends DatabaseBackend {
parent::flush();
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -121,7 +119,7 @@ class InstallBackend extends DatabaseBackend {
parent::expire();
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -133,7 +131,7 @@ class InstallBackend extends DatabaseBackend {
parent::garbageCollection();
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
}
/**
@@ -145,7 +143,7 @@ class InstallBackend extends DatabaseBackend {
return parent::isEmpty();
}
}
- catch (Exception $e) {}
+ catch (\Exception $e) {}
return TRUE;
}
}
diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index c736245..c7db0ec 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -3,7 +3,6 @@
namespace Drupal\Core\Config;
use Drupal\Core\Config\StorageBase;
-use Exception;
/**
* Represents an SQL-based configuration storage object.
@@ -25,7 +24,7 @@ class DatabaseStorage extends StorageBase {
$data = $this->decode($raw);
}
}
- catch (Exception $e) {
+ catch (\Exception $e) {
}
return $data;
}
diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 94a23fb..2eb95ea 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -10,9 +10,6 @@ namespace Drupal\Core\Database;
use Drupal\Core\Database\TransactionNoActiveException;
use Drupal\Core\Database\TransactionOutOfOrderException;
-use PDO;
-use PDOException;
-
/**
* Base Database API class.
*
@@ -23,7 +20,7 @@ use PDOException;
*
* @see http://php.net/manual/book.pdo.php
*/
-abstract class Connection extends PDO {
+abstract class Connection extends \PDO {
/**
* The database target this connection is for.
@@ -140,14 +137,14 @@ abstract class Connection extends PDO {
$this->setPrefix(isset($this->connectionOptions['prefix']) ? $this->connectionOptions['prefix'] : '');
// Because the other methods don't seem to work right.
- $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
+ $driver_options[\PDO::ATTR_ERRMODE] = \PDO::ERRMODE_EXCEPTION;
// Call PDO::__construct and PDO::setAttribute.
parent::__construct($dsn, $username, $password, $driver_options);
// Set a specific PDOStatement class if the driver requires that.
if (!empty($this->statementClass)) {
- $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
+ $this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
}
}
@@ -199,7 +196,7 @@ abstract class Connection extends PDO {
protected function defaultOptions() {
return array(
'target' => 'default',
- 'fetch' => PDO::FETCH_OBJ,
+ 'fetch' => \PDO::FETCH_OBJ,
'return' => Database::RETURN_STATEMENT,
'throw_exception' => TRUE,
);
@@ -519,10 +516,10 @@ abstract class Connection extends PDO {
case Database::RETURN_NULL:
return;
default:
- throw new PDOException('Invalid return directive: ' . $options['return']);
+ throw new \PDOException('Invalid return directive: ' . $options['return']);
}
}
- catch (PDOException $e) {
+ catch (\PDOException $e) {
if ($options['throw_exception']) {
// Wrap the exception in another exception, because PHP does not allow
// overriding Exception::getMessage(). Its message is the extra database
@@ -1041,7 +1038,7 @@ abstract class Connection extends PDO {
* Returns the version of the database server.
*/
public function version() {
- return $this->getAttribute(PDO::ATTR_SERVER_VERSION);
+ return $this->getAttribute(\PDO::ATTR_SERVER_VERSION);
}
/**
diff --git a/core/lib/Drupal/Core/Database/DatabaseExceptionWrapper.php b/core/lib/Drupal/Core/Database/DatabaseExceptionWrapper.php
index b212478..f9527d4 100644
--- a/core/lib/Drupal/Core/Database/DatabaseExceptionWrapper.php
+++ b/core/lib/Drupal/Core/Database/DatabaseExceptionWrapper.php
@@ -7,13 +7,11 @@
namespace Drupal\Core\Database;
-use RuntimeException;
-
/**
* This wrapper class serves only to provide additional debug information.
*
* This class will always wrap a PDOException.
*/
-class DatabaseExceptionWrapper extends RuntimeException implements DatabaseException {
+class DatabaseExceptionWrapper extends \RuntimeException implements DatabaseException {
}
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
index fbbff42..629fd68 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
@@ -14,8 +14,6 @@ use Drupal\Core\Database\TransactionCommitFailedException;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\Database\Connection as DatabaseConnection;
-use PDO;
-
/**
* @addtogroup database
* @{
@@ -54,9 +52,9 @@ class Connection extends DatabaseConnection {
);
$connection_options['pdo'] += array(
// So we don't have to mess around with cursors and unbuffered queries by default.
- PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,
+ \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,
// Because MySQL's prepared statements skip the query cache, because it's dumb.
- PDO::ATTR_EMULATE_PREPARES => TRUE,
+ \PDO::ATTR_EMULATE_PREPARES => TRUE,
);
parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);
@@ -173,7 +171,7 @@ class Connection extends DatabaseConnection {
// If there are no more layers left then we should commit.
unset($this->transactionLayers[$name]);
if (empty($this->transactionLayers)) {
- if (!PDO::commit()) {
+ if (!\PDO::commit()) {
throw new TransactionCommitFailedException();
}
}
@@ -196,7 +194,7 @@ class Connection extends DatabaseConnection {
$this->transactionLayers = array();
// We also have to explain to PDO that the transaction stack has
// been cleaned-up.
- PDO::commit();
+ \PDO::commit();
}
else {
throw $e;
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
index 37efb97..b9e8b6d 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
@@ -13,8 +13,6 @@ use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
-use Exception;
-
/**
* @addtogroup schemaapi
* @{
@@ -516,7 +514,7 @@ class Schema extends DatabaseSchema {
$this->connection->queryRange("SELECT 1 FROM {" . $table . "}", 0, 1);
return TRUE;
}
- catch (Exception $e) {
+ catch (\Exception $e) {
return FALSE;
}
}
@@ -533,7 +531,7 @@ class Schema extends DatabaseSchema {
$this->connection->queryRange("SELECT $column FROM {" . $table . "}", 0, 1);
return TRUE;
}
- catch (Exception $e) {
+ catch (\Exception $e) {
return FALSE;
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
index b3f6d64..48db03b 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
@@ -11,9 +11,6 @@ use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection as DatabaseConnection;
use Drupal\Core\Database\StatementInterface;
-use PDO;
-use PDOException;
-
/**
* @addtogroup database
* @{
@@ -68,9 +65,9 @@ class Connection extends DatabaseConnection {
// prepared queries are not re-used, it should be faster to emulate
// the preparation than to actually ready statements for re-use. If in
// doubt, reset to FALSE and measure performance.
- PDO::ATTR_EMULATE_PREPARES => TRUE,
+ \PDO::ATTR_EMULATE_PREPARES => TRUE,
// Convert numeric values to strings when fetching.
- PDO::ATTR_STRINGIFY_FETCHES => TRUE,
+ \PDO::ATTR_STRINGIFY_FETCHES => TRUE,
);
parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);
@@ -119,10 +116,10 @@ class Connection extends DatabaseConnection {
case Database::RETURN_NULL:
return;
default:
- throw new PDOException('Invalid return directive: ' . $options['return']);
+ throw new \PDOException('Invalid return directive: ' . $options['return']);
}
}
- catch (PDOException $e) {
+ catch (\PDOException $e) {
if ($options['throw_exception']) {
// Add additional debug information.
if ($query instanceof StatementInterface) {
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
index dffa1fd..eb5a51d 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
@@ -10,8 +10,6 @@ namespace Drupal\Core\Database\Driver\pgsql;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\Insert as QueryInsert;
-use PDO;
-
/**
* @ingroup database
* @{
@@ -39,7 +37,7 @@ class Insert extends QueryInsert {
fwrite($blobs[$blob_count], $insert_values[$idx]);
rewind($blobs[$blob_count]);
- $stmt->bindParam(':db_insert_placeholder_' . $max_placeholder++, $blobs[$blob_count], PDO::PARAM_LOB);
+ $stmt->bindParam(':db_insert_placeholder_' . $max_placeholder++, $blobs[$blob_count], \PDO::PARAM_LOB);
// Pre-increment is faster in PHP than increment.
++$blob_count;
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index 6dc40a2..7c50bf9 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -10,8 +10,6 @@ namespace Drupal\Core\Database\Driver\pgsql\Install;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Install\Tasks as InstallTasks;
-use Exception;
-
/**
* PostgreSQL specific install functions
*/
@@ -60,7 +58,7 @@ class Tasks extends InstallTasks {
$this->fail(st($text, $replacements));
}
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(st('Drupal could not determine the encoding of the database was set to UTF-8'));
}
}
@@ -87,7 +85,7 @@ class Tasks extends InstallTasks {
try {
db_query($query);
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// Ignore possible errors when the user doesn't have the necessary
// privileges to ALTER the database.
}
@@ -175,7 +173,7 @@ class Tasks extends InstallTasks {
$this->pass(st('PostgreSQL has initialized itself.'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(st('Drupal could not be correctly setup with the existing database. Revise any errors.'));
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
index 6ce4a0a..d08e6c5 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
@@ -13,8 +13,6 @@ use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
-use Exception;
-
/**
* @addtogroup schemaapi
* @{
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Update.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Update.php
index de738bf..60dc15d 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Update.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Update.php
@@ -10,8 +10,6 @@ namespace Drupal\Core\Database\Driver\pgsql;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\Update as QueryUpdate;
-use PDO;
-
class Update extends QueryUpdate {
public function execute() {
@@ -49,7 +47,7 @@ class Update extends QueryUpdate {
$blobs[$blob_count] = fopen('php://memory', 'a');
fwrite($blobs[$blob_count], $value);
rewind($blobs[$blob_count]);
- $stmt->bindParam($placeholder, $blobs[$blob_count], PDO::PARAM_LOB);
+ $stmt->bindParam($placeholder, $blobs[$blob_count], \PDO::PARAM_LOB);
++$blob_count;
}
else {
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
index 02a55a4..718f812 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
@@ -14,9 +14,6 @@ use Drupal\Core\Database\TransactionCommitFailedException;
use Drupal\Core\Database\Driver\sqlite\Statement;
use Drupal\Core\Database\Connection as DatabaseConnection;
-use PDO;
-use Exception;
-
/**
* Specific SQLite implementation of DatabaseConnection.
*/
@@ -74,7 +71,7 @@ class Connection extends DatabaseConnection {
);
$connection_options['pdo'] += array(
// Convert numeric values to strings when fetching.
- PDO::ATTR_STRINGIFY_FETCHES => TRUE,
+ \PDO::ATTR_STRINGIFY_FETCHES => TRUE,
);
parent::__construct('sqlite:' . $connection_options['database'], '', '', $connection_options['pdo']);
@@ -140,7 +137,7 @@ class Connection extends DatabaseConnection {
unlink($this->connectionOptions['database'] . '-' . $prefix);
}
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// Ignore the exception and continue. There is nothing we can do here
// to report the error or fail safe.
}
@@ -331,7 +328,7 @@ class Connection extends DatabaseConnection {
}
}
if ($this->supportsTransactions()) {
- PDO::rollBack();
+ \PDO::rollBack();
}
}
@@ -346,7 +343,7 @@ class Connection extends DatabaseConnection {
throw new TransactionNameNonUniqueException($name . " is already in use.");
}
if (!$this->inTransaction()) {
- PDO::beginTransaction();
+ \PDO::beginTransaction();
}
$this->transactionLayers[$name] = $name;
}
@@ -371,9 +368,9 @@ class Connection extends DatabaseConnection {
// If there was any rollback() we should roll back whole transaction.
if ($this->willRollback) {
$this->willRollback = FALSE;
- PDO::rollBack();
+ \PDO::rollBack();
}
- elseif (!PDO::commit()) {
+ elseif (!\PDO::commit()) {
throw new TransactionCommitFailedException();
}
}
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
index 823cd13..b28c5fe 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
@@ -11,8 +11,6 @@ use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Core\Database\Schema as DatabaseSchema;
-use Exception;
-
/**
* @ingroup schemaapi
@@ -451,7 +449,7 @@ class Schema extends DatabaseSchema {
}
}
else {
- new Exception("Unable to parse the column type " . $row->type);
+ new \Exception("Unable to parse the column type " . $row->type);
}
}
$indexes = array();
@@ -688,4 +686,4 @@ class Schema extends DatabaseSchema {
));
return $result->fetchAllKeyed(0, 0);
}
-}
\ No newline at end of file
+}
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php
index 531b6d0..0adc6c2 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php
@@ -10,9 +10,6 @@ namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Core\Database\StatementPrefetch;
use Drupal\Core\Database\StatementInterface;
-use Iterator;
-use PDOException;
-
/**
* Specific SQLite implementation of DatabaseConnection.
*
@@ -21,7 +18,7 @@ use PDOException;
*
* @see DatabaseConnection_sqlite::PDOPrepare()
*/
-class Statement extends StatementPrefetch implements Iterator, StatementInterface {
+class Statement extends StatementPrefetch implements \Iterator, StatementInterface {
/**
* SQLite specific implementation of getStatement().
@@ -93,7 +90,7 @@ class Statement extends StatementPrefetch implements Iterator, StatementInterfac
try {
$return = parent::execute($args, $options);
}
- catch (PDOException $e) {
+ catch (\PDOException $e) {
if (!empty($e->errorInfo[1]) && $e->errorInfo[1] === 17) {
// The schema has changed. SQLite specifies that we must resend the query.
$return = parent::execute($args, $options);
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index 5d34a62..f1370be 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -9,9 +9,6 @@ namespace Drupal\Core\Database\Install;
use Drupal\Core\Database\Database;
-use PDO;
-use Exception;
-
/**
* Database installer structure.
*
@@ -81,7 +78,7 @@ abstract class Tasks {
* Ensure the PDO driver is supported by the version of PHP in use.
*/
protected function hasPdoDriver() {
- return in_array($this->pdoDriver, PDO::getAvailableDrivers());
+ return in_array($this->pdoDriver, \PDO::getAvailableDrivers());
}
/**
@@ -166,7 +163,7 @@ abstract class Tasks {
Database::getConnection();
$this->pass('Drupal can CONNECT to the database ok.');
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(st('Failed to connect to your database server. The server reports the following message: %error.
- Is the database server running?
- Does the database exist, and have you entered the correct database name?
- Have you entered the correct username and password?
- Have you entered the correct database hostname?
', array('%error' => $e->getMessage())));
return FALSE;
}
@@ -181,7 +178,7 @@ abstract class Tasks {
db_query($query);
$this->pass(st($pass));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(st($fail, array('%query' => $query, '%error' => $e->getMessage(), '%name' => $this->name())));
return !$fatal;
}
diff --git a/core/lib/Drupal/Core/Database/Query/Insert.php b/core/lib/Drupal/Core/Database/Query/Insert.php
index b3c4c0e..7862436 100644
--- a/core/lib/Drupal/Core/Database/Query/Insert.php
+++ b/core/lib/Drupal/Core/Database/Query/Insert.php
@@ -9,8 +9,6 @@ namespace Drupal\Core\Database\Query;
use Drupal\Core\Database\Database;
-use Exception;
-
/**
* General class for an abstracted INSERT query.
*/
@@ -220,7 +218,7 @@ class Insert extends Query {
$last_insert_id = $this->connection->query($sql, $insert_values, $this->queryOptions);
}
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// One of the INSERTs failed, rollback the whole batch.
$transaction->rollback();
// Rethrow the exception for the calling code.
diff --git a/core/lib/Drupal/Core/Database/Query/Merge.php b/core/lib/Drupal/Core/Database/Query/Merge.php
index 547a223..93ddee0 100644
--- a/core/lib/Drupal/Core/Database/Query/Merge.php
+++ b/core/lib/Drupal/Core/Database/Query/Merge.php
@@ -10,8 +10,6 @@ namespace Drupal\Core\Database\Query;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection;
-use Exception;
-
/**
* General class for an abstracted MERGE query operation.
*
@@ -423,7 +421,7 @@ class Merge extends Query implements ConditionInterface {
$insert->execute();
return self::STATUS_INSERT;
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// The insert query failed, maybe it's because a racing insert query
// beat us in inserting the same row. Retry the select query, if it
// returns a row, ignore the error and continue with the update
@@ -446,7 +444,7 @@ class Merge extends Query implements ConditionInterface {
return self::STATUS_UPDATE;
}
}
- catch (Exception $e) {
+ catch (\Exception $e) {
// Something really wrong happened here, bubble up the exception to the
// caller.
$transaction->rollback();
diff --git a/core/lib/Drupal/Core/Database/Statement.php b/core/lib/Drupal/Core/Database/Statement.php
index c5b1735..1ff2ff4 100644
--- a/core/lib/Drupal/Core/Database/Statement.php
+++ b/core/lib/Drupal/Core/Database/Statement.php
@@ -7,9 +7,6 @@
namespace Drupal\Core\Database;
-use PDO;
-use PDOStatement;
-
/**
* Default implementation of DatabaseStatementInterface.
*
@@ -21,7 +18,7 @@ use PDOStatement;
*
* @see http://php.net/pdostatement
*/
-class Statement extends PDOStatement implements StatementInterface {
+class Statement extends \PDOStatement implements StatementInterface {
/**
* Reference to the database connection object for this statement.
@@ -34,7 +31,7 @@ class Statement extends PDOStatement implements StatementInterface {
protected function __construct($dbh) {
$this->dbh = $dbh;
- $this->setFetchMode(PDO::FETCH_OBJ);
+ $this->setFetchMode(\PDO::FETCH_OBJ);
}
public function execute($args = array(), $options = array()) {
@@ -43,7 +40,7 @@ class Statement extends PDOStatement implements StatementInterface {
// Default to an object. Note: db fields will be added to the object
// before the constructor is run. If you need to assign fields after
// the constructor is run, see http://drupal.org/node/315092.
- $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
+ $this->setFetchMode(\PDO::FETCH_CLASS, $options['fetch']);
}
else {
$this->setFetchMode($options['fetch']);
@@ -70,14 +67,14 @@ class Statement extends PDOStatement implements StatementInterface {
}
public function fetchCol($index = 0) {
- return $this->fetchAll(PDO::FETCH_COLUMN, $index);
+ return $this->fetchAll(\PDO::FETCH_COLUMN, $index);
}
public function fetchAllAssoc($key, $fetch = NULL) {
$return = array();
if (isset($fetch)) {
if (is_string($fetch)) {
- $this->setFetchMode(PDO::FETCH_CLASS, $fetch);
+ $this->setFetchMode(\PDO::FETCH_CLASS, $fetch);
}
else {
$this->setFetchMode($fetch);
@@ -94,7 +91,7 @@ class Statement extends PDOStatement implements StatementInterface {
public function fetchAllKeyed($key_index = 0, $value_index = 1) {
$return = array();
- $this->setFetchMode(PDO::FETCH_NUM);
+ $this->setFetchMode(\PDO::FETCH_NUM);
foreach ($this as $record) {
$return[$record[$key_index]] = $record[$value_index];
}
@@ -108,6 +105,6 @@ class Statement extends PDOStatement implements StatementInterface {
public function fetchAssoc() {
// Call PDOStatement::fetch to fetch the row.
- return $this->fetch(PDO::FETCH_ASSOC);
+ return $this->fetch(\PDO::FETCH_ASSOC);
}
}
diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php
index 18dd582..ddb8225 100644
--- a/core/lib/Drupal/Core/Database/StatementPrefetch.php
+++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php
@@ -8,9 +8,6 @@
namespace Drupal\Core\Database;
use Drupal\Core\Database\Connection;
-use Iterator;
-use PDO;
-use PDOException;
/**
* An implementation of DatabaseStatementInterface that prefetches all data.
@@ -18,7 +15,7 @@ use PDOException;
* This class behaves very similar to a PDOStatement but as it always fetches
* every row it is possible to manipulate those results.
*/
-class StatementPrefetch implements Iterator, StatementInterface {
+class StatementPrefetch implements \Iterator, StatementInterface {
/**
* The query string.
@@ -91,7 +88,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
*
* @var int
*/
- protected $fetchStyle = PDO::FETCH_OBJ;
+ protected $fetchStyle = \PDO::FETCH_OBJ;
/**
* Holds supplementary current fetch options (which will be used by the next fetch).
@@ -110,7 +107,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
*
* @var int
*/
- protected $defaultFetchStyle = PDO::FETCH_OBJ;
+ protected $defaultFetchStyle = \PDO::FETCH_OBJ;
/**
* Holds supplementary default fetch options.
@@ -146,7 +143,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
// Default to an object. Note: db fields will be added to the object
// before the constructor is run. If you need to assign fields after
// the constructor is run, see http://drupal.org/node/315092.
- $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
+ $this->setFetchMode(\PDO::FETCH_CLASS, $options['fetch']);
}
else {
$this->setFetchMode($options['fetch']);
@@ -172,7 +169,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
// Fetch all the data from the reply, in order to release any lock
// as soon as possible.
$this->rowCount = $statement->rowCount();
- $this->data = $statement->fetchAll(PDO::FETCH_ASSOC);
+ $this->data = $statement->fetchAll(\PDO::FETCH_ASSOC);
// Destroy the statement as soon as possible. See
// DatabaseConnection_sqlite::PDOPrepare() for explanation.
unset($statement);
@@ -203,7 +200,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
protected function throwPDOException() {
$error_info = $this->dbh->errorInfo();
// We rebuild a message formatted in the same way as PDO.
- $exception = new PDOException("SQLSTATE[" . $error_info[0] . "]: General error " . $error_info[1] . ": " . $error_info[2]);
+ $exception = new \PDOException("SQLSTATE[" . $error_info[0] . "]: General error " . $error_info[1] . ": " . $error_info[2]);
$exception->errorInfo = $error_info;
throw $exception;
}
@@ -238,16 +235,16 @@ class StatementPrefetch implements Iterator, StatementInterface {
public function setFetchMode($fetchStyle, $a2 = NULL, $a3 = NULL) {
$this->defaultFetchStyle = $fetchStyle;
switch ($fetchStyle) {
- case PDO::FETCH_CLASS:
+ case \PDO::FETCH_CLASS:
$this->defaultFetchOptions['class'] = $a2;
if ($a3) {
$this->defaultFetchOptions['constructor_args'] = $a3;
}
break;
- case PDO::FETCH_COLUMN:
+ case \PDO::FETCH_COLUMN:
$this->defaultFetchOptions['column'] = $a2;
break;
- case PDO::FETCH_INTO:
+ case \PDO::FETCH_INTO:
$this->defaultFetchOptions['object'] = $a2;
break;
}
@@ -270,23 +267,23 @@ class StatementPrefetch implements Iterator, StatementInterface {
public function current() {
if (isset($this->currentRow)) {
switch ($this->fetchStyle) {
- case PDO::FETCH_ASSOC:
+ case \PDO::FETCH_ASSOC:
return $this->currentRow;
- case PDO::FETCH_BOTH:
+ case \PDO::FETCH_BOTH:
// PDO::FETCH_BOTH returns an array indexed by both the column name
// and the column number.
return $this->currentRow + array_values($this->currentRow);
- case PDO::FETCH_NUM:
+ case \PDO::FETCH_NUM:
return array_values($this->currentRow);
- case PDO::FETCH_LAZY:
+ case \PDO::FETCH_LAZY:
// We do not do lazy as everything is fetched already. Fallback to
// PDO::FETCH_OBJ.
- case PDO::FETCH_OBJ:
+ case \PDO::FETCH_OBJ:
return (object) $this->currentRow;
- case PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE:
+ case \PDO::FETCH_CLASS | \PDO::FETCH_CLASSTYPE:
$class_name = array_unshift($this->currentRow);
// Deliberate no break.
- case PDO::FETCH_CLASS:
+ case \PDO::FETCH_CLASS:
if (!isset($class_name)) {
$class_name = $this->fetchOptions['class'];
}
@@ -301,12 +298,12 @@ class StatementPrefetch implements Iterator, StatementInterface {
$result->$k = $v;
}
return $result;
- case PDO::FETCH_INTO:
+ case \PDO::FETCH_INTO:
foreach ($this->currentRow as $k => $v) {
$this->fetchOptions['object']->$k = $v;
}
return $this->fetchOptions['object'];
- case PDO::FETCH_COLUMN:
+ case \PDO::FETCH_COLUMN:
if (isset($this->columnNames[$this->fetchOptions['column']])) {
return $this->currentRow[$k][$this->columnNames[$this->fetchOptions['column']]];
}
@@ -348,7 +345,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
return $this->rowCount;
}
- public function fetch($fetch_style = NULL, $cursor_orientation = PDO::FETCH_ORI_NEXT, $cursor_offset = NULL) {
+ public function fetch($fetch_style = NULL, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = NULL) {
if (isset($this->currentRow)) {
// Set the fetch parameter.
$this->fetchStyle = isset($fetch_style) ? $fetch_style : $this->defaultFetchStyle;
@@ -392,7 +389,7 @@ class StatementPrefetch implements Iterator, StatementInterface {
$result = (object) $this->currentRow;
}
else {
- $this->fetchStyle = PDO::FETCH_CLASS;
+ $this->fetchStyle = \PDO::FETCH_CLASS;
$this->fetchOptions = array('constructor_args' => $constructor_args);
// Grab the row in the format specified above.
$result = $this->current();
diff --git a/core/lib/Drupal/Core/Updater/UpdaterException.php b/core/lib/Drupal/Core/Updater/UpdaterException.php
index aee43a6..c859831 100644
--- a/core/lib/Drupal/Core/Updater/UpdaterException.php
+++ b/core/lib/Drupal/Core/Updater/UpdaterException.php
@@ -7,8 +7,6 @@
namespace Drupal\Core\Updater;
-use Exception;
-
/**
* Defines a Exception class for the Drupal\Core\Updater\Updater class
* hierarchy.
@@ -17,5 +15,5 @@ use Exception;
* specific name so that call sites that want to tell the difference can
* specifically catch these exceptions and treat them differently.
*/
-class UpdaterException extends Exception {
+class UpdaterException extends \Exception {
}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityController.php b/core/modules/entity/lib/Drupal/entity/EntityController.php
index 3edc4cc..f1cb2f5 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityController.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityController.php
@@ -7,8 +7,6 @@
namespace Drupal\entity;
-use PDO;
-
/**
* Defines a base entity controller class.
*
@@ -165,7 +163,7 @@ class EntityController implements EntityControllerInterface {
// We provide the necessary arguments for PDO to create objects of the
// specified entity class.
// @see Drupal\entity\EntityInterface::__construct()
- $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType));
+ $query_result->setFetchMode(\PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType));
}
$queried_entities = $query_result->fetchAllAssoc($this->idKey);
}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php b/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php
index 12f2a1c..ee6f934 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php
@@ -7,8 +7,6 @@
namespace Drupal\entity;
-use Exception;
-
/**
* Exception thrown by EntityFieldQuery() on unsupported query syntax.
*
@@ -16,4 +14,4 @@ use Exception;
* conditions, and will raise an EntityFieldQueryException when an unsupported
* condition was specified.
*/
-class EntityFieldQueryException extends Exception { }
+class EntityFieldQueryException extends \Exception { }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php b/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php
index bd9b500..48d80d0 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php
@@ -7,9 +7,7 @@
namespace Drupal\entity;
-use Exception;
-
/**
* Defines an exception thrown when a malformed entity is passed.
*/
-class EntityMalformedException extends Exception { }
+class EntityMalformedException extends \Exception { }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageException.php b/core/modules/entity/lib/Drupal/entity/EntityStorageException.php
index dff3e93..573d677 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityStorageException.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityStorageException.php
@@ -7,9 +7,7 @@
namespace Drupal\entity;
-use Exception;
-
/**
* Defines an exception thrown when storage operations fail.
*/
-class EntityStorageException extends Exception { }
+class EntityStorageException extends \Exception { }
diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php
index dccec71..e439929 100644
--- a/core/modules/node/lib/Drupal/node/NodeStorageController.php
+++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php
@@ -10,7 +10,6 @@ namespace Drupal\node;
use Drupal\entity\EntityDatabaseStorageController;
use Drupal\entity\EntityInterface;
use Drupal\entity\EntityStorageException;
-use Exception;
/**
* Controller class for nodes.
@@ -72,7 +71,7 @@ class NodeStorageController extends EntityDatabaseStorageController {
// Ignore slave server temporarily.
db_ignore_slave();
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
throw new EntityStorageException($e->getMessage, $e->getCode, $e);
@@ -119,7 +118,7 @@ class NodeStorageController extends EntityDatabaseStorageController {
return $return;
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index f66b2ac..f0574d3 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -8,7 +8,6 @@
namespace Drupal\node\Tests;
use Drupal\Core\Database\Database;
-use Exception;
class NodeCreationTest extends NodeTestBase {
public static function getInfo() {
@@ -63,7 +62,7 @@ class NodeCreationTest extends NodeTestBase {
entity_create('node', $edit)->save();
$this->fail(t('Expected exception has not been thrown.'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->pass(t('Expected exception has been thrown.'));
}
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
index dc6d95a..624b342 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Exception;
-
/**
* Tests node_query_node_access_alter().
*/
@@ -84,7 +82,7 @@ class NodeQueryAlterTest extends NodeTestBase {
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 4, t('User with access can see correct nodes'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(t('Altered query is malformed'));
}
}
@@ -107,7 +105,7 @@ class NodeQueryAlterTest extends NodeTestBase {
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User with no access cannot see nodes'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(t('Altered query is malformed'));
}
}
@@ -130,7 +128,7 @@ class NodeQueryAlterTest extends NodeTestBase {
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User with view-only access cannot edit nodes'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail($e->getMessage());
$this->fail((string) $query);
$this->fail(t('Altered query is malformed'));
@@ -170,7 +168,7 @@ class NodeQueryAlterTest extends NodeTestBase {
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User view privileges are not overridden'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(t('Altered query is malformed'));
}
@@ -192,7 +190,7 @@ class NodeQueryAlterTest extends NodeTestBase {
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 4, t('User view privileges are overridden'));
}
- catch (Exception $e) {
+ catch (\Exception $e) {
$this->fail(t('Altered query is malformed'));
}
variable_del('node_test_node_access_all_uid');
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 3bb1e0c..efd05c2 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -9,11 +9,6 @@ namespace Drupal\simpletest;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\ConnectionNotDefinedException;
-use PDO;
-use stdClass;
-use DOMDocument;
-use DOMXPath;
-use SimpleXMLElement;
/**
* Test case for typical Drupal tests.
@@ -419,7 +414,7 @@ abstract class WebTestBase extends TestBase {
}
// Create new role.
- $role = new stdClass();
+ $role = new \stdClass();
$role->name = $name;
user_role_save($role);
user_role_grant_permissions($role->rid, $permissions);
@@ -672,7 +667,7 @@ abstract class WebTestBase extends TestBase {
foreach (array('registry', 'registry_file') as $table) {
// Find the records from the parent database.
$source_query = $original_connection
- ->select($table, array(), array('fetch' => PDO::FETCH_ASSOC))
+ ->select($table, array(), array('fetch' => \PDO::FETCH_ASSOC))
->fields($table);
$dest_query = $test_connection->insert($table);
@@ -954,7 +949,7 @@ abstract class WebTestBase extends TestBase {
if (!$this->elements) {
// DOM can load HTML soup. But, HTML soup can throw warnings, suppress
// them.
- $htmlDom = new DOMDocument();
+ $htmlDom = new \DOMDocument();
@$htmlDom->loadHTML('' . $this->drupalGetContent());
if ($htmlDom) {
$this->pass(t('Valid HTML found on "@path"', array('@path' => $this->getUrl())), t('Browser'));
@@ -1272,10 +1267,10 @@ abstract class WebTestBase extends TestBase {
);
// DOM can load HTML soup. But, HTML soup can throw warnings, suppress
// them.
- $dom = new DOMDocument();
+ $dom = new \DOMDocument();
@$dom->loadHTML($content);
// XPath allows for finding wrapper nodes better than DOM does.
- $xpath = new DOMXPath($dom);
+ $xpath = new \DOMXPath($dom);
foreach ($return as $command) {
switch ($command['command']) {
case 'settings':
@@ -1297,7 +1292,7 @@ abstract class WebTestBase extends TestBase {
}
if ($wrapperNode) {
// ajax.js adds an enclosing DIV to work around a Safari bug.
- $newDom = new DOMDocument();
+ $newDom = new \DOMDocument();
$newDom->loadHTML('' . $command['data'] . '
');
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
@@ -1630,7 +1625,7 @@ abstract class WebTestBase extends TestBase {
* @return
* Option elements in select.
*/
- protected function getAllOptions(SimpleXMLElement $element) {
+ protected function getAllOptions(\SimpleXMLElement $element) {
$options = array();
// Add all options items.
foreach ($element->option as $option) {
@@ -2291,7 +2286,7 @@ abstract class WebTestBase extends TestBase {
* @return
* The selected value or FALSE.
*/
- protected function getSelectedItem(SimpleXMLElement $element) {
+ protected function getSelectedItem(\SimpleXMLElement $element) {
foreach ($element->children() as $item) {
if (isset($item['selected'])) {
return $item['value'];
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
index e0a25f9..01382ca 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
@@ -8,7 +8,6 @@
namespace Drupal\statistics\Tests;
use Drupal\simpletest\WebTestBase;
-use PDO;
/**
* Tests that logging via statistics_exit() works for all pages.
@@ -72,7 +71,7 @@ class StatisticsLoggingTest extends WebTestBase {
$stats_path = $base_url . '/' . drupal_get_path('module', 'statistics'). '/statistics.php';
drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
$this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Testing an uncached page.'));
- $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
+ $log = db_query('SELECT * FROM {accesslog}')->fetchAll(\PDO::FETCH_ASSOC);
$this->assertTrue(is_array($log) && count($log) == 1, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[0], $expected), $expected);
$node_counter = statistics_get($this->node->nid);
@@ -83,7 +82,7 @@ class StatisticsLoggingTest extends WebTestBase {
// Manually calling statistics.php, simulating ajax behavior.
drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
$this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Testing a cached page.'));
- $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
+ $log = db_query('SELECT * FROM {accesslog}')->fetchAll(\PDO::FETCH_ASSOC);
$this->assertTrue(is_array($log) && count($log) == 2, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[1], $expected), $expected);
$node_counter = statistics_get($this->node->nid);
@@ -94,7 +93,7 @@ class StatisticsLoggingTest extends WebTestBase {
$this->drupalGet($path);
// Manually calling statistics.php, simulating ajax behavior.
drupal_http_request($stats_path, array('method' => 'POST', 'data' => $post, 'headers' => $headers, 'timeout' => 10000));
- $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
+ $log = db_query('SELECT * FROM {accesslog}')->fetchAll(\PDO::FETCH_ASSOC);
// Check the 6th item since login and account pages are also logged
$this->assertTrue(is_array($log) && count($log) == 6, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[5], $expected), $expected);
@@ -108,7 +107,7 @@ class StatisticsLoggingTest extends WebTestBase {
'path' => $path,
);
$this->drupalGet($path);
- $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
+ $log = db_query('SELECT * FROM {accesslog}')->fetchAll(\PDO::FETCH_ASSOC);
$this->assertTrue(is_array($log) && count($log) == 7, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[6], $expected), $expected);
@@ -122,7 +121,7 @@ class StatisticsLoggingTest extends WebTestBase {
// Test that the long path is properly truncated when logged.
$this->drupalGet($long_path);
- $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
+ $log = db_query('SELECT * FROM {accesslog}')->fetchAll(\PDO::FETCH_ASSOC);
$this->assertTrue(is_array($log) && count($log) == 8, 'Page request was logged for a path over 255 characters.');
$this->assertEqual($log[7]['path'], truncate_utf8($long_path, 255));