diff --git a/src/Core/DatabaselessKernel.php b/src/Core/DatabaselessKernel.php new file mode 100644 index 00000000000..f4bfcc6fcb7 --- /dev/null +++ b/src/Core/DatabaselessKernel.php @@ -0,0 +1,47 @@ +bootErrorHandling = $bool; + return $this; + } + + public function boot($flush = false) + { + $this->flush = $flush; + + $this->bootPHP(); + $this->bootManifests($flush); + + if ($this->bootErrorHandling) { + $this->bootErrorHandling(); + } + + $this->bootConfigs(); + + $this->booted = true; + } +} diff --git a/src/ORM/Connect/NullDatabase.php b/src/ORM/Connect/NullDatabase.php new file mode 100644 index 00000000000..eed77578e63 --- /dev/null +++ b/src/ORM/Connect/NullDatabase.php @@ -0,0 +1,314 @@ +errorMessage = $msg; + return $this; + } + + /** + * @param string $msg + * @return self + */ + public function setQueryErrorMessage(string $msg) + { + $this->queryErrorMessage = $msg; + return $this; + } + + public function query($sql, $errorLevel = E_USER_ERROR) + { + throw new \LogicException(sprintf($this->queryErrorMessage, $sql)); + } + + public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) + { + throw new \LogicException(sprintf($this->queryErrorMessage, $sql)); + } + + public function getConnector() + { + throw new \LogicException($this->errorMessage); + } + + public function getSchemaManager() + { + throw new \LogicException($this->errorMessage); + } + + public function getQueryBuilder() + { + throw new \LogicException($this->errorMessage); + } + + public function getGeneratedID($table) + { + // no-op + } + + public function isActive() + { + return true; + } + + public function escapeString($value) + { + return $value; + } + + public function quoteString($value) + { + return $value; + } + + public function escapeIdentifier($value, $separator = '.') + { + return $value; + } + + protected function escapeColumnKeys($fieldValues) + { + return $fieldValues; + } + + public function manipulate($manipulation) + { + throw new \LogicException($this->errorMessage); + } + + public function clearAllData() + { + throw new \LogicException($this->errorMessage); + } + + public function clearTable($table) + { + throw new \LogicException($this->errorMessage); + } + + public function nullCheckClause($field, $isNull) + { + return ''; + } + + public function comparisonClause( + $field, + $value, + $exact = false, + $negate = false, + $caseSensitive = null, + $parameterised = false + ) { + return ''; + } + + public function formattedDatetimeClause($date, $format) + { + return ''; + } + + public function datetimeIntervalClause($date, $interval) + { + return ''; + } + + public function datetimeDifferenceClause($date1, $date2) + { + return ''; + } + + public function concatOperator() + { + return ''; + } + + public function supportsCollations() + { + return false; + } + + public function supportsTimezoneOverride() + { + return false; + } + + public function getVersion() + { + return ''; + } + + public function getDatabaseServer() + { + return ''; + } + + public function affectedRows() + { + return 0; + } + + public function searchEngine( + $classesToSearch, + $keywords, + $start, + $pageLength, + $sortBy = "Relevance DESC", + $extraFilter = "", + $booleanSearch = false, + $alternativeFileFilter = "", + $invertedMatch = false + ) { + // no-op + } + + public function supportsTransactions() + { + return false; + } + + public function supportsSavepoints() + { + return false; + } + + + public function supportsTransactionMode(string $mode): bool + { + return false; + } + + public function withTransaction( + $callback, + $errorCallback = null, + $transactionMode = false, + $errorIfTransactionsUnsupported = false + ) { + // no-op + } + + public function supportsExtensions($extensions) + { + return false; + } + + public function transactionStart($transactionMode = false, $sessionCharacteristics = false) + { + // no-op + } + + public function transactionSavepoint($savepoint) + { + // no-op + } + + public function transactionRollback($savepoint = false) + { + // no-op + } + + public function transactionEnd($chain = false) + { + // no-op + } + + public function transactionDepth() + { + return 0; + } + + public function supportsLocks() + { + return false; + } + + public function canLock($name) + { + return false; + } + + public function getLock($name, $timeout = 5) + { + return false; + } + + public function releaseLock($name) + { + return false; + } + + public function connect($parameters) + { + // no-op + } + + public function databaseExists($name) + { + return false; + } + + public function databaseList() + { + return []; + } + + public function selectDatabase($name, $create = false, $errorLevel = E_USER_ERROR) + { + // no-op + } + + public function dropSelectedDatabase() + { + // no-op + } + + public function getSelectedDatabase() + { + // no-op + } + + public function now() + { + return ''; + } + + public function random() + { + return ''; + } +}