Fixes incompatibilities with older versions of PHP

FILE: tainacan/src/importer/class-tainacan-importer.php
-----------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------
 603 | ERROR | 'int' type declaration is not present in PHP version 5.6 or earlier
 616 | ERROR | 'int' type declaration is not present in PHP version 5.6 or earlier
 616 | ERROR | 'int' type declaration is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------

FILE: tainacan/src/classes/class-tainacan-elastic-press.php
----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 16 | ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and
    |       | prohibited since PHP 5.4
 24 | ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and
    |       | prohibited since PHP 5.4
----------------------------------------------------------------------------------------

FILE: tainacan/src/classes/class-tainacan-bulk-edit.php
----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 78 | ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and
    |       | prohibited since PHP 5.4
 85 | ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and
    |       | prohibited since PHP 5.4
----------------------------------------------------------------------------------------
This commit is contained in:
weryques 2018-08-02 08:57:32 -03:00
parent 5503096a42
commit a80d64cfb8
4 changed files with 8 additions and 6 deletions

View File

@ -75,14 +75,14 @@ class Bulk_Edit {
add_filter('posts_pre_query', '__return_empty_array'); add_filter('posts_pre_query', '__return_empty_array');
// this adds the meta key and meta value to the SELECT query so it can be used directly in the INSERT below // this adds the meta key and meta value to the SELECT query so it can be used directly in the INSERT below
add_filter('posts_fields_request', [&$this, 'add_fields_to_query'], 10, 2); add_filter('posts_fields_request', [$this, 'add_fields_to_query'], 10, 2);
$itemsRepo = Repositories\Items::get_instance(); $itemsRepo = Repositories\Items::get_instance();
$params['query']['fields'] = 'ids'; $params['query']['fields'] = 'ids';
$items_query = $itemsRepo->fetch($params['query'], $params['collection_id']); $items_query = $itemsRepo->fetch($params['query'], $params['collection_id']);
remove_filter('posts_pre_query', '__return_empty_array'); remove_filter('posts_pre_query', '__return_empty_array');
remove_filter('posts_fields_request', [&$this, 'add_fields_to_query']); remove_filter('posts_fields_request', [$this, 'add_fields_to_query']);
$wpdb->query( "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) {$items_query->request}" ); $wpdb->query( "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) {$items_query->request}" );

View File

@ -13,7 +13,7 @@ namespace Tainacan;
class Elastic_Press { class Elastic_Press {
function __construct($ajax_query=false) { function __construct($ajax_query=false) {
add_action('init', [&$this, 'init']); add_action('init', [$this, 'init']);
} }
@ -21,7 +21,7 @@ class Elastic_Press {
if (!class_exists('EP_API')) { if (!class_exists('EP_API')) {
return; // ElasticPress not active return; // ElasticPress not active
} }
add_filter('tainacan_fetch_args', [&$this, 'filter_args'], 10, 2); add_filter('tainacan_fetch_args', [$this, 'filter_args'], 10, 2);
} }
function filter_args($args, $type) { function filter_args($args, $type) {

View File

@ -600,7 +600,7 @@ abstract class Importer {
* the current progress of the process. * the current progress of the process.
* *
*/ */
protected function set_current_step_total(int $value) { protected function set_current_step_total($value) {
$this->set_step_total($this->get_current_step(), $value); $this->set_step_total($this->get_current_step(), $value);
} }
@ -613,7 +613,7 @@ abstract class Importer {
* the current progress of the process. * the current progress of the process.
* *
*/ */
protected function set_step_total(int $step, int $value) { protected function set_step_total($step, $value) {
$steps = $this->get_steps(); $steps = $this->get_steps();
if (isset($steps[$step]) && is_array($steps[$step])) { if (isset($steps[$step]) && is_array($steps[$step])) {
$steps[$step]['total'] = $value; $steps[$step]['total'] = $value;

View File

@ -5,4 +5,6 @@ echo 'W is Warning'
echo 'E is Error' echo 'E is Error'
./src/vendor/bin/phpcs -p . --standard=PHPCompatibility --extensions=php --ignore=*/node_modules/*,*/src/vendor/* --report-file=./report.txt --runtime-set testVersion 5.6 ./src/vendor/bin/phpcs -p . --standard=PHPCompatibility --extensions=php --ignore=*/node_modules/*,*/src/vendor/* --report-file=./report.txt --runtime-set testVersion 5.6
echo 'Done'
echo 'Results are in ./report.txt'