Merge pull request #208 from creative-commoners/pulls/3.1/proxification
NEW Update to use proxied DB instead of self-proxied
This commit is contained in:
commit
990c996c97
|
@ -1,5 +1,11 @@
|
||||||
inherit: true
|
inherit: true
|
||||||
|
|
||||||
|
build:
|
||||||
|
nodes:
|
||||||
|
analysis:
|
||||||
|
tests:
|
||||||
|
override: [php-scrutinizer-run]
|
||||||
|
|
||||||
checks:
|
checks:
|
||||||
php:
|
php:
|
||||||
code_rating: true
|
code_rating: true
|
||||||
|
|
|
@ -1,32 +1,6 @@
|
||||||
---
|
---
|
||||||
Name: fulltextsearchmysql
|
Name: fulltextsearchproxydb
|
||||||
After:
|
|
||||||
- 'databaseconnectors'
|
|
||||||
---
|
---
|
||||||
SilverStripe\Core\Injector\Injector:
|
TractorCow\SilverStripeProxyDB\ProxyDBFactory:
|
||||||
MySQLDatabase:
|
extensions:
|
||||||
class: SilverStripe\FullTextSearch\Search\Captures\SearchManipulateCapture_MySQLDatabase
|
- SilverStripe\FullTextSearch\Search\Extensions\ProxyDBExtension
|
||||||
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
|
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
"silverstripe/framework": "^4.0",
|
"silverstripe/framework": "^4.0",
|
||||||
"monolog/monolog": "~1.15",
|
"monolog/monolog": "~1.15",
|
||||||
"ptcinc/solr-php-client": "^1.0",
|
"ptcinc/solr-php-client": "^1.0",
|
||||||
"symfony/process": "^3.2"
|
"symfony/process": "^3.2",
|
||||||
|
"tractorcow/silverstripe-proxy-db" : "~0.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"silverstripe/cms": "^4.0",
|
"silverstripe/cms": "^4.0",
|
||||||
|
|
|
@ -5,6 +5,10 @@ namespace SilverStripe\FullTextSearch\Search\Captures;
|
||||||
use SilverStripe\ORM\Connect\MySQLDatabase;
|
use SilverStripe\ORM\Connect\MySQLDatabase;
|
||||||
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
|
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
|
class SearchManipulateCapture_MySQLDatabase extends MySQLDatabase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ if (!class_exists(PostgreSQLDatabase::class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.1...4.0 Please use tractorcow/silverstripe-proxy-db to proxy the database connector instead
|
||||||
|
*/
|
||||||
|
|
||||||
class SearchManipulateCapture_PostgreSQLDatabase extends PostgreSQLDatabase
|
class SearchManipulateCapture_PostgreSQLDatabase extends PostgreSQLDatabase
|
||||||
{
|
{
|
||||||
public $isManipulationCapture = true;
|
public $isManipulationCapture = true;
|
||||||
|
|
|
@ -9,6 +9,10 @@ if (!class_exists(SQLite3Database::class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.1...4.0 Please use tractorcow/silverstripe-proxy-db to proxy the database connector instead
|
||||||
|
*/
|
||||||
|
|
||||||
class SearchManipulateCapture_SQLite3Database extends SQLite3Database
|
class SearchManipulateCapture_SQLite3Database extends SQLite3Database
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\FullTextSearch\Search\Extensions;
|
||||||
|
|
||||||
|
use SilverStripe\Core\Extension;
|
||||||
|
use TractorCow\ClassProxy\Generators\ProxyGenerator;
|
||||||
|
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This database connector proxy will allow {@link SearchUpdater::handle_manipulation} to monitor database schema
|
||||||
|
* changes that may need to be propagated through to search indexes.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class ProxyDBExtension extends Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param ProxyGenerator $proxy
|
||||||
|
*
|
||||||
|
* Ensure the search index is kept up to date by monitoring SilverStripe database manipulations
|
||||||
|
*/
|
||||||
|
public function updateProxy(ProxyGenerator &$proxy)
|
||||||
|
{
|
||||||
|
$proxy = $proxy->addMethod('manipulate', function ($args, $next) {
|
||||||
|
$manipulation = $args[0];
|
||||||
|
SearchUpdater::handle_manipulation($manipulation);
|
||||||
|
return $next(...$args);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ class SearchUpdater
|
||||||
public static $processor = null;
|
public static $processor = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the SearchManiplateCapture database adapter with every manipulation made against the database.
|
* Called by the ProxyDBExtension database connector with every manipulation made against the database.
|
||||||
*
|
*
|
||||||
* Check every index to see what objects need re-inserting into what indexes to keep the index fresh,
|
* Check every index to see what objects need re-inserting into what indexes to keep the index fresh,
|
||||||
* but doesn't actually do it yet.
|
* but doesn't actually do it yet.
|
||||||
|
|
Loading…
Reference in New Issue