Skip to content

Commit

Permalink
Prepare new release after several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Jan 17, 2019
1 parent cbfb100 commit 83bd058
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 25 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changelog

## 3.2.0 (ToDo)
## 3.2.0 (2019-01-17)
* Added CSV format alternative for search/replace [#82](https://github.com/inpsyde/search-and-replace/issues/82).
* Improve code structure, preparation for more solid UnitTests.
* Improve Modal Table UI.
* Added Multiline searching [#119](https://github.com/inpsyde/search-and-replace/issues/119).
* Fix several issues to run always with php 5.6 to 7.2

## v3.1.2 (2016-12-31)
- hotfix: prevent declaration error with Requisite
Expand Down
3 changes: 2 additions & 1 deletion inc/Page/ReplaceDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct( Database\Manager $dbm, Database\Exporter $dbe, File

/**
* @return bool
* @throws \Throwable
*/
public function save() {

Expand Down Expand Up @@ -80,7 +81,7 @@ public function save() {
*/
public function render() {

require_once( __DIR__ . '/../templates/replace-domain.php' );
require_once __DIR__ . '/../templates/replace-domain.php';
}

/**
Expand Down
18 changes: 9 additions & 9 deletions inc/Page/SearchReplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Inpsyde\SearchReplace\Page;

use Inpsyde\SearchReplace\Database;
use Inpsyde\SearchReplace\Service;
use Inpsyde\SearchReplace\FileDownloader;

/**
Expand Down Expand Up @@ -54,7 +53,7 @@ public function __construct( Database\Manager $dbm, Database\Replace $replace, D
*/
public function render() {

require_once( __DIR__ . '/../templates/search-replace.php' );
require_once __DIR__ . '/../templates/search-replace.php';

wp_localize_script(
'insr-js',
Expand Down Expand Up @@ -98,6 +97,7 @@ public function get_slug() {

/**
* @return bool
* @throws \Throwable
*/
public function save() {

Expand All @@ -122,7 +122,7 @@ public function save() {

// Do not perform anything if we haven't anything.
if ( ( ! $search && ! $replace ) && ! $csv ) {
$this->add_error( esc_html__( 'You must provide at least a search string or a csv data' ) );
$this->add_error( esc_html__( 'You must provide at least a search string or a csv data', 'search-and-replace' ) );
return false;
}

Expand Down Expand Up @@ -180,15 +180,15 @@ protected function is_request_valid() {
}

/**
* Calls run_replace_table() on each table provided in array $tables
* Calls run_replace_table() on each table provided in array $tables.
*
* @param string $search
* @param string $replace
* @param array $tables array of tables we want to search
* @param bool $dry_run True if dry run (no changes are written to db)
* @param array $tables Array of tables we want to search.
* @param bool $dry_run True if dry run (no changes are written to db).
* @param bool $csv
*
* @return null
* @throws \Throwable
*/
protected function run_replace( $search, $replace, $tables, $dry_run, $csv = null ) {

Expand All @@ -214,7 +214,7 @@ protected function run_replace( $search, $replace, $tables, $dry_run, $csv = nul
$report = $this->replace->run_search_replace( $search, $replace, $tables, $csv );

if ( is_wp_error( $report ) ) {
$this->add_error( __( $report->get_error_message(), 'search-and-replace' ) );
$this->add_error( $report->get_error_message() );
} else {
if ( count( $report[ 'changes' ] ) > 0 ) {
$this->downloader->show_changes( $report );
Expand Down Expand Up @@ -264,7 +264,7 @@ protected function show_table_list() {
);

}
echo( '</select>' );
echo '</select>';
}

/**
Expand Down
13 changes: 7 additions & 6 deletions inc/Page/SqlImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function get_submit_button_title() {
*/
public function save() {

// TODO: Better handling of large files
// @ToDo: Better handling of large files
// maybe like here: http://stackoverflow.com/questions/147821/loading-sql-files-from-within-php , answer by user 'gromo'
$php_upload_error_code = $_FILES[ 'file_to_upload' ][ 'error' ];
if ( 0 === $php_upload_error_code ) {
Expand Down Expand Up @@ -104,11 +104,12 @@ public function save() {
echo '<div class="updated notice is-dismissible">';
echo '<p>';
printf(
// Translators: %s print the sql source.
esc_html__(
'The SQL file was successfully imported. %s SQL queries were performed.',
'search-and-replace'
),
$success
esc_html($success)
);
echo '</p></div>';
}
Expand Down Expand Up @@ -150,6 +151,7 @@ public function save() {

$this->add_error(
sprintf(
// Translators: %s print the error message.
esc_html__( 'Upload Error: %s', 'search-and-replace' ),
$php_upload_errors[ $php_upload_error_code ]
)
Expand All @@ -159,7 +161,7 @@ public function save() {
}

/**
* reads a gz file into a string
* Reads a gz file into a string.
*
* @param string $filename String path ot file.
*
Expand Down Expand Up @@ -213,10 +215,9 @@ private function parse_size( $size ) {
$size = preg_replace( '/[^0-9\.]/', '', $size );
if ( $unit ) {
// Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
return round( $size * pow( 1024, stripos( 'bkmgtpezy', $unit[0] ) ) );
} else {
return round( $size );
return round( $size * ( 1024 ** stripos( 'bkmgtpezy', $unit[0] ) ) );
}
return round( $size );
}

}
2 changes: 1 addition & 1 deletion inpsyde-search-replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author: Inpsyde GmbH
* URI: https://inpsyde.com
* Contributors: s-hinse, derpixler, ChriCo, Bueltge, inpsyde
* Version: 3.2.0-dev
* Version: 3.2.0
* Text Domain: search-and-replace
* Domain Path: /languages
* License: GPLv3+
Expand Down
4 changes: 2 additions & 2 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
<arg name="extensions" value="php"/> <!-- Limit to PHP files -->
<!-- Rules: Check PHP version compatibility - see
https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<!--<rule ref="PHPCompatibilityWP"/>-->
<rule ref="PHPCompatibilityWP"/>
<!-- For help in understanding this testVersion:
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<!--<config name="testVersion" value="5.6-"/>-->
<config name="testVersion" value="5.6-"/>
<!-- Rules: WordPress Coding Standards - see
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<rule ref="WordPress-Extra"/><!-- Includes WordPress-Core -->
Expand Down
13 changes: 8 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: inpsyde, Bueltge, derpixler, ChriCo, s-hinse, Giede
Tags: search, replace, backup, import, sql, migrate, multisite
Requires at least: 4.0
Tested up to: 4.9
Stable tag: 3.1.2
Tested up to: 5.1
Stable tag: 3.2

Search & Replace data in your database with WordPress admin, replace domains/URLs of your WordPress installation.

Expand Down Expand Up @@ -60,9 +60,12 @@ You want to donate - we prefer a [positive review](https://wordpress.org/support
5. Result screen after search or search and replace

== Changelog ==
= 3.2.0 (ToDo) =
* Added CSV format alternative for search/replace [#82].
* Change code structure, preparation for more solid UnitTests.
= 3.2.0 (2019-01-17) =
* Added CSV format alternative for search/replace [#82](https://github.com/inpsyde/search-and-replace/issues/82).
* Improve code structure, preparation for more solid UnitTests.
* Improve Modal Table UI.
* Added Multiline searching [#119](https://github.com/inpsyde/search-and-replace/issues/119).
* Fix several issues to run always with php 5.6 to 7.2.

= v3.1.2 (2016-12-31) =
* hotfix: prevent declaration error with Requisite
Expand Down

0 comments on commit 83bd058

Please sign in to comment.