Added php 7.2 support

This commit is contained in:
Magnus Bengtsson 2019-04-15 08:31:29 +12:00 committed by Robbie Averill
parent 0692e2adad
commit ab8e316f5b
5 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-fulltextsearch.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-fulltextsearch) [![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-fulltextsearch.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-fulltextsearch)
Adds support for fulltext search engines like Sphinx and Solr to SilverStripe CMS. Adds support for fulltext search engines like Sphinx and Solr to SilverStripe CMS.
Compatible with PHP 7.2
## Maintainer Contact ## Maintainer Contact

View File

@ -1,5 +1,9 @@
<?php <?php
// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) class_alias('Object', 'SS_Object');
global $databaseConfig; global $databaseConfig;
if (isset($databaseConfig['type'])) SearchUpdater::bind_manipulation_capture(); if (isset($databaseConfig['type'])) SearchUpdater::bind_manipulation_capture();

View File

@ -342,7 +342,7 @@ abstract class SearchIndex extends ViewableData
if (preg_match('/^(\w+)\(/', $type, $match)) { if (preg_match('/^(\w+)\(/', $type, $match)) {
$type = $match[1]; $type = $match[1];
} }
list($type, $args) = Object::parse_class_spec($type); list($type, $args) = SS_Object::parse_class_spec($type);
if (is_subclass_of($type, 'StringField')) { if (is_subclass_of($type, 'StringField')) {
$this->addFulltextField($field); $this->addFulltextField($field);
} }

View File

@ -12,7 +12,7 @@
* *
* TODO: The way we bind in is awful hacky. * TODO: The way we bind in is awful hacky.
*/ */
class SearchUpdater extends Object class SearchUpdater extends SS_Object
{ {
/** /**
* Replace the database object with a subclass that captures all manipulations and passes them to us * Replace the database object with a subclass that captures all manipulations and passes them to us

View File

@ -117,7 +117,7 @@ class Solr
$options = self::solr_options(); $options = self::solr_options();
if (!self::$service_singleton) { if (!self::$service_singleton) {
self::$service_singleton = Object::create( self::$service_singleton = SS_Object::create(
$options['service'], $options['host'], $options['port'], $options['path'] $options['service'], $options['host'], $options['port'], $options['path']
); );
} }