mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
NEW Update to use proxied DB instead of self-proxied
This commit is contained in:
parent
685148f6fb
commit
e7420a584d
@ -1,32 +1,6 @@
|
||||
---
|
||||
Name: fulltextsearchmysql
|
||||
After:
|
||||
- 'databaseconnectors'
|
||||
Name: fulltextsearchproxydb
|
||||
---
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
MySQLDatabase:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_MySQLDatabase
|
||||
MySQLPDODatabase:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_MySQLDatabase
|
||||
|
||||
---
|
||||
Name: fulltextsearchpostgresql
|
||||
After:
|
||||
- 'postgresqlconnectors'
|
||||
---
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
PostgrePDODatabase:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_PostgreSQLDatabase
|
||||
PostgreSQLDatabase:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_PostgreSQLDatabase
|
||||
|
||||
---
|
||||
Name: fulltextsearchsqlite
|
||||
After:
|
||||
- 'sqlite3connectors'
|
||||
---
|
||||
SilverStripe\Core\Injector\Injector:
|
||||
SQLite3PDODatabase:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_SQLite3Database
|
||||
SQLite3Database:
|
||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_SQLite3Database
|
||||
TractorCow\SilverStripeProxyDB\ProxyDBFactory:
|
||||
extensions:
|
||||
- SilverStripe\FullTextSearch\Search\Extensions\ProxyDBExtension
|
||||
|
@ -24,7 +24,8 @@
|
||||
"silverstripe/framework": "^4.0",
|
||||
"monolog/monolog": "~1.15",
|
||||
"ptcinc/solr-php-client": "^1.0",
|
||||
"symfony/process": "^3.2"
|
||||
"symfony/process": "^3.2",
|
||||
"tractorcow/silverstripe-proxy-db" : "~0.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"silverstripe/cms": "^4.0",
|
||||
|
@ -5,6 +5,10 @@ namespace SilverStripe\FullTextSearch\Search\Captures;
|
||||
use SilverStripe\ORM\Connect\MySQLDatabase;
|
||||
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
|
||||
|
||||
/**
|
||||
* @deprecated 3.1...4.0 Please use tractorcow/silverstripe-proxy-db to proxy the database connector instead
|
||||
*/
|
||||
|
||||
class SearchManipulateCapture_MySQLDatabase extends MySQLDatabase
|
||||
{
|
||||
|
||||
|
@ -9,6 +9,10 @@ if (!class_exists(PostgreSQLDatabase::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.1...4.0 Please use tractorcow/silverstripe-proxy-db to proxy the database connector instead
|
||||
*/
|
||||
|
||||
class SearchManipulateCapture_PostgreSQLDatabase extends PostgreSQLDatabase
|
||||
{
|
||||
public $isManipulationCapture = true;
|
||||
|
@ -9,6 +9,10 @@ if (!class_exists(SQLite3Database::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.1...4.0 Please use tractorcow/silverstripe-proxy-db to proxy the database connector instead
|
||||
*/
|
||||
|
||||
class SearchManipulateCapture_SQLite3Database extends SQLite3Database
|
||||
{
|
||||
|
||||
|
19
src/Search/Extensions/ProxyDBExtension.php
Normal file
19
src/Search/Extensions/ProxyDBExtension.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Search\Extensions;
|
||||
|
||||
use SilverStripe\Core\Extension;
|
||||
use TractorCow\ClassProxy\Generators\ProxyGenerator;
|
||||
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
|
||||
|
||||
class ProxyDBExtension extends Extension
|
||||
{
|
||||
public function updateProxy(ProxyGenerator &$proxy)
|
||||
{
|
||||
$proxy = $proxy->addMethod('manipulate', function ($args, $next) {
|
||||
$manipulation = $args[0];
|
||||
SearchUpdater::handle_manipulation($manipulation);
|
||||
return $next(...$args);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user