Commit 92286713 authored by Crell's avatar Crell

Move database files to the new lib directory and update code accordingly.

parent 86c93f3b
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Symfony\Component\ClassLoader\UniversalClassLoader; use Symfony\Component\ClassLoader\UniversalClassLoader;
use Symfony\Component\ClassLoader\ApcUniversalClassLoader; use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
......
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
/** /**
* @file * @file
......
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Database\Query\Condition; use Drupal\Core\Database\Query\Condition;
/** /**
* @file * @file
......
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Database\Install\TaskException; use Drupal\Core\Database\Install\TaskException;
/** /**
* @file * @file
...@@ -234,7 +234,23 @@ function install_begin_request(&$install_state) { ...@@ -234,7 +234,23 @@ function install_begin_request(&$install_state) {
// Ensure that the class loader is available so that we can leverage classes // Ensure that the class loader is available so that we can leverage classes
// as part of the install routine. // as part of the install routine.
drupal_initialize_classloader(); $loader = drupal_classloader();
// Register explicit vendor namespaces.
$loader->registerNamespaces(array(
// All Symfony-borrowed code lives in /core/includes/Symfony.
'Symfony' => DRUPAL_ROOT . '/core/vendor',
));
// Register the Drupal namespace for classes in core as a fallback.
// This allows to register additional namespaces within the Drupal namespace
// (e.g., for modules) and avoids an additional file_exists() on the Drupal
// core namespace, since the class loader can already determine the best
// namespace match based on a string comparison. It further allows modules to
// register/overload namespaces in Drupal core.
$loader->registerNamespaceFallbacks(array(
// All Drupal-namespaced code in core lives in /core/includes/Drupal.
'Drupal' => DRUPAL_ROOT . '/core/lib',
));
if (!$install_state['interactive']) { if (!$install_state['interactive']) {
drupal_override_server_variables($install_state['server']); drupal_override_server_variables($install_state['server']);
......
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
/** /**
* Indicates that a module has not been installed yet. * Indicates that a module has not been installed yet.
...@@ -256,7 +256,7 @@ function drupal_get_database_types() { ...@@ -256,7 +256,7 @@ function drupal_get_database_types() {
// Because we have no registry yet, we need to also include the install.inc // Because we have no registry yet, we need to also include the install.inc
// file for the driver explicitly. // file for the driver explicitly.
require_once DRUPAL_ROOT . '/core/includes/database/database.inc'; require_once DRUPAL_ROOT . '/core/includes/database/database.inc';
foreach (file_scan_directory(DRUPAL_ROOT . '/core/includes/Drupal/Database/Driver', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) { foreach (file_scan_directory(DRUPAL_ROOT . '/core/lib/Drupal/Core/Database/Driver', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) {
if (file_exists($file->uri . '/Install/Tasks.php')) { if (file_exists($file->uri . '/Install/Tasks.php')) {
$drivers[$file->filename] = $file->uri; $drivers[$file->filename] = $file->uri;
} }
...@@ -1006,6 +1006,6 @@ function db_run_tasks($driver) { ...@@ -1006,6 +1006,6 @@ function db_run_tasks($driver) {
function db_installer_object($driver) { function db_installer_object($driver) {
// We cannot use Database::getConnection->getDriverClass() here, because // We cannot use Database::getConnection->getDriverClass() here, because
// the connection object is not yet functional. // the connection object is not yet functional.
$task_class = "Drupal\\Database\\Driver\\{$driver}\\Install\\Tasks"; $task_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Install\\Tasks";
return new $task_class(); return new $task_class();
} }
<?php <?php
use Drupal\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Database\Query\SelectExtender; use Drupal\Core\Database\Query\SelectExtender;
use Drupal\Database\Query\SelectInterface; use Drupal\Core\Database\Query\SelectInterface;
/** /**
* @file * @file
......
<?php <?php
use Drupal\Database\Database; use Drupal\Core\Database\Database;
/** /**
* @file * @file
......
<?php <?php
use Drupal\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Database\Query\SelectExtender; use Drupal\Core\Database\Query\SelectExtender;
use Drupal\Database\Query\SelectInterface; use Drupal\Core\Database\Query\SelectInterface;
/** /**
* @file * @file
......
<?php <?php
namespace Drupal\Database; namespace Drupal\Core\Database;
use Drupal\Database\DatabaseTransactionNoActiveException; use Drupal\Core\Database\DatabaseTransactionNoActiveException;
use Drupal\Database\DatabaseTransactionOutOfOrderException; use Drupal\Core\Database\DatabaseTransactionOutOfOrderException;
use PDO; use PDO;
use PDOException; use PDOException;
...@@ -70,7 +70,7 @@ abstract class Connection extends PDO { ...@@ -70,7 +70,7 @@ abstract class Connection extends PDO {
* *
* @var string * @var string
*/ */
protected $statementClass = '\\Drupal\\Database\\StatementBase'; protected $statementClass = '\\Drupal\\Core\\Database\\StatementBase';
/** /**
* Whether this database connection supports transactions. * Whether this database connection supports transactions.
...@@ -593,7 +593,7 @@ protected function expandArguments(&$query, &$args) { ...@@ -593,7 +593,7 @@ protected function expandArguments(&$query, &$args) {
public function getDriverClass($class) { public function getDriverClass($class) {
if (empty($this->driverClasses[$class])) { if (empty($this->driverClasses[$class])) {
$driver = $this->driver(); $driver = $this->driver();
$driver_class = "Drupal\\Database\\Driver\\{$driver}\\{$class}"; $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\{$class}";
$this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class; $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
} }
return $this->driverClasses[$class]; return $this->driverClasses[$class];
......
<?php <?php
namespace Drupal\Database; namespace Drupal\Core\Database;
use RuntimeException; use RuntimeException;
......
<?php <?php
namespace Drupal\Database; namespace Drupal\Core\Database;
/** /**
* Primary front-controller for the database system. * Primary front-controller for the database system.
...@@ -371,7 +371,7 @@ public static function addConnectionInfo($key, $target, $info) { ...@@ -371,7 +371,7 @@ public static function addConnectionInfo($key, $target, $info) {
// We cannot rely on the registry yet, because the registry requires an // We cannot rely on the registry yet, because the registry requires an
// open database connection. // open database connection.
$driver_class = "Drupal\\Database\\Driver\\{$driver}\\Connection"; $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
$new_connection = new $driver_class(self::$databaseInfo[$key][$target]); $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
$new_connection->setTarget($target); $new_connection->setTarget($target);
$new_connection->setKey($key); $new_connection->setKey($key);
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Database\DatabaseTransactionCommitFailedException; use Drupal\Core\Database\DatabaseTransactionCommitFailedException;
use Drupal\Database\Connection as DatabaseConnection; use Drupal\Core\Database\Connection as DatabaseConnection;
use PDO; use PDO;
use PDOException; use PDOException;
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Delete as QueryDelete; use Drupal\Core\Database\Query\Delete as QueryDelete;
class Delete extends QueryDelete { } class Delete extends QueryDelete { }
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Insert as QueryInsert; use Drupal\Core\Database\Query\Insert as QueryInsert;
class Insert extends QueryInsert { class Insert extends QueryInsert {
......
<?php <?php
namespace Drupal\Database\Driver\mysql\Install; namespace Drupal\Core\Database\Driver\mysql\Install;
use Drupal\Database\Install\Tasks as InstallTasks; use Drupal\Core\Database\Install\Tasks as InstallTasks;
/** /**
* Specifies installation tasks for MySQL and equivalent databases. * Specifies installation tasks for MySQL and equivalent databases.
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Merge as QueryMerge; use Drupal\Core\Database\Query\Merge as QueryMerge;
class Merge extends QueryMerge { } class Merge extends QueryMerge { }
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Database\Query\Condition; use Drupal\Core\Database\Query\Condition;
use Drupal\Database\SchemaObjectExistsException; use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Database\SchemaObjectDoesNotExistException; use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Database\Schema as DatabaseSchema; use Drupal\Core\Database\Schema as DatabaseSchema;
use Exception; use Exception;
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Select as QuerySelect; use Drupal\Core\Database\Query\Select as QuerySelect;
class Select extends QuerySelect { } class Select extends QuerySelect { }
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Transaction as DatabaseTransaction; use Drupal\Core\Database\Transaction as DatabaseTransaction;
class Transaction extends DatabaseTransaction { } class Transaction extends DatabaseTransaction { }
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Truncate as QueryTruncate; use Drupal\Core\Database\Query\Truncate as QueryTruncate;
class Truncate extends QueryTruncate { class Truncate extends QueryTruncate {
public function __toString() { public function __toString() {
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\mysql;
use Drupal\Database\Query\Update as QueryUpdate; use Drupal\Core\Database\Query\Update as QueryUpdate;
class Update extends QueryUpdate { } class Update extends QueryUpdate { }
<?php <?php
namespace Drupal\Database\Driver\pgsql\Install; namespace Drupal\Core\Database\Driver\pgsql\Install;
use Drupal\Database\Install\Tasks as InstallTasks; use Drupal\Core\Database\Install\Tasks as InstallTasks;
/** /**
* PostgreSQL specific install functions * PostgreSQL specific install functions
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Database\TransactionNoActiveException; use Drupal\Core\Database\TransactionNoActiveException;
use Drupal\Database\TransactionNameNonUniqueException; use Drupal\Core\Database\TransactionNameNonUniqueException;
use Drupal\Database\TransactionCommitFailedException; use Drupal\Core\Database\TransactionCommitFailedException;
use Drupal\Database\Driver\sqlite\Statement; use Drupal\Core\Database\Driver\sqlite\Statement;
use Drupal\Database\Connection as DatabaseConnection; use Drupal\Core\Database\Connection as DatabaseConnection;
use PDO; use PDO;
use Exception; use Exception;
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Delete as QueryDelete; use Drupal\Core\Database\Query\Delete as QueryDelete;
/** /**
* SQLite specific implementation of DeleteQuery. * SQLite specific implementation of DeleteQuery.
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Insert as QueryInsert; use Drupal\Core\Database\Query\Insert as QueryInsert;
/** /**
* SQLite specific implementation of InsertQuery. * SQLite specific implementation of InsertQuery.
......
<?php <?php
namespace Drupal\Database\Driver\sqlite\Install; namespace Drupal\Core\Database\Driver\sqlite\Install;
use Drupal\Database\Install\Tasks as InstallTasks; use Drupal\Core\Database\Install\Tasks as InstallTasks;
use SplFileInfo; use SplFileInfo;
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Merge as QueryMerge; use Drupal\Core\Database\Query\Merge as QueryMerge;
class Merge extends QueryMerge { } class Merge extends QueryMerge { }
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\SchemaObjectExistsException; use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Database\SchemaObjectDoesNotExistException; use Drupal\Core\Database\SchemaObjectDoesNotExistException;
use Drupal\Database\Schema as DatabaseSchema; use Drupal\Core\Database\Schema as DatabaseSchema;
use Exception; use Exception;
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Select as QuerySelect; use Drupal\Core\Database\Query\Select as QuerySelect;
class Select extends QuerySelect { class Select extends QuerySelect {
public function forUpdate($set = TRUE) { public function forUpdate($set = TRUE) {
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\StatementPrefetch; use Drupal\Core\Database\StatementPrefetch;
use Drupal\Database\StatementInterface; use Drupal\Core\Database\StatementInterface;
use Iterator; use Iterator;
use PDOException; use PDOException;
......
<?php <?php
namespace Drupal\Database\Driver\mysql; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Transaction as DatabaseTransaction; use Drupal\Core\Database\Transaction as DatabaseTransaction;
class Transaction extends DatabaseTransaction { } class Transaction extends DatabaseTransaction { }
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Truncate as QueryTruncate; use Drupal\Core\Database\Query\Truncate as QueryTruncate;
/** /**
* SQLite specific implementation of TruncateQuery. * SQLite specific implementation of TruncateQuery.
......
<?php <?php
namespace Drupal\Database\Driver\sqlite; namespace Drupal\Core\Database\Driver\sqlite;
use Drupal\Database\Query\Condition; use Drupal\Core\Database\Query\Condition;
use Drupal\Database\Query\ConditionInterface; use Drupal\Core\Database\Query\ConditionInterface;
use Drupal\Database\Query\Update as QueryUpdate; use Drupal\Core\Database\Query\Update as QueryUpdate;
/** /**
* SQLite specific implementation of UpdateQuery. * SQLite specific implementation of UpdateQuery.
......
<?php <?php
namespace Drupal\Database; namespace Drupal\Core\Database;
use RuntimeException; use RuntimeException;
......
<?php <?php
namespace Drupal\Database\Install; namespace Drupal\Core\Database\Install;
use RuntimeException; use RuntimeException;
......
<?php <?php
namespace Drupal\Database\Install; namespace Drupal\Core\Database\Install;
use Drupal\Database\Database; use Drupal\Core\Database\Database;