Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Search Replace Plugin - needs translation help #184

Closed
evilzenscientist opened this issue Feb 7, 2017 · 7 comments
Closed

Better Search Replace Plugin - needs translation help #184

evilzenscientist opened this issue Feb 7, 2017 · 7 comments

Comments

@evilzenscientist
Copy link

Here's a plugin that seems to be talking directly to mysql: https://wordpress.org/plugins-wp/better-search-replace/

Any chance this can be reviewed - here are the three attempts to run - the plugin is not enumerating the list of tables:

2017-02-07 07:44:35 Error Code: 2812 -- Query NOT translated due to non-defined error code.
SHOW TABLES
2017-02-07 07:44:35 Error Code: 156 -- Begin Query translation attempt:
SHOW TABLE STATUS
2017-02-07 07:44:35 -- Translation result:
SHOW TABLE STATUS

2017-02-07 07:45:48 Error Code: 2812 -- Query NOT translated due to non-defined error code.
SHOW TABLES
2017-02-07 07:45:48 Error Code: 156 -- Begin Query translation attempt:
SHOW TABLE STATUS
2017-02-07 07:45:48 -- Translation result:
SHOW TABLE STATUS

2017-02-07 07:45:52 Error Code: 2812 -- Query NOT translated due to non-defined error code.
SHOW TABLES
2017-02-07 07:45:52 Error Code: 156 -- Begin Query translation attempt:
SHOW TABLE STATUS
2017-02-07 07:45:52 -- Translation result:
SHOW TABLE STATUS

@evilzenscientist
Copy link
Author

Ok - class-bsr-db.php has all of this hardcoded:

if ( is_main_site() ) { $tables = $wpdb->get_col( 'SHOW TABLES' ); } else { $blog_id = get_current_blog_id(); $tables = $wpdb->get_col( "SHOW TABLES LIKE '" . $wpdb->base_prefix . absint( $blog_id ) . "\_%'" ); }

(and lots more)

@patrickebates
Copy link
Member

Seems this is slipping by the translator due to a single character. Will prepare a fix.

@evilzenscientist
Copy link
Author

Splendid. Back to testing. What was the original source of the MSSQL-mysql translation project (colleague was asking about this).

@patrickebates
Copy link
Member

There are two answers to that question. When we initially created Project Nami, we did not intend to support any translation on the fly at all. We rewrote WP Core as necessary to support SQL Server (quite frankly, it was seen as the only viable option after the failure of several translation plugins). And for our own use, we forked several popular plugins and did the same with them.

Eventually we decided to attempt translating only plugins, as maintaining those forks alongside PN itself became too cumbersome. So as is mentioned in our license.txt file, we took the core translation file from the old DB Abstraction Plugin, modified it to operate in a fallback mode, and expanded it with better handling for a variety of plugins (which it originally was very poor at).

Note that PN itself does not require any translation. All core functions are still rewritten in the code itself, and will continue to be.

@evilzenscientist
Copy link
Author

evilzenscientist commented Feb 8, 2017

See my comment on the commit - I don't think this resolved this issue.

2017-02-08 21:32:47 Error Code: 2812 -- Query NOT translated due to non-defined error code.
SHOW TABLES
2017-02-08 21:32:47 Error Code: 156 -- Begin Query translation attempt:
SHOW TABLE STATUS
2017-02-08 21:32:47 -- Translation result:
SHOW TABLE STATUS

[08-Feb-2017 21:32:47 UTC] WordPress database error [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Could not find stored procedure 'SHOW'. Code - 2812 for query SHOW TABLES made by require_once('D:\home\site\wwwroot\wp-admin\admin.php'), do_action('tools_page_better-search-replace'), WP_Hook->do_action, WP_Hook->apply_filters, BSR_Admin->bsr_menu_pages_callback, require_once('D:\home\site\wwwroot\wp-content\plugins\better-search-replace\templates\bsr-dashboard.php'), include('D:\home\site\wwwroot\wp-content\plugins\better-search-replace\templates\bsr-search-replace.php'), BSR_Admin::load_tables, BSR_DB::get_tables
[08-Feb-2017 21:32:47 UTC] WordPress database error [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'TABLE'. Code - 156 for query SHOW TABLE STATUS made by require_once('D:\home\site\wwwroot\wp-admin\admin.php'), do_action('tools_page_better-search-replace'), WP_Hook->do_action, WP_Hook->apply_filters, BSR_Admin->bsr_menu_pages_callback, require_once('D:\home\site\wwwroot\wp-content\plugins\better-search-replace\templates\bsr-dashboard.php'), include('D:\home\site\wwwroot\wp-content\plugins\better-search-replace\templates\bsr-search-replace.php'), BSR_Admin::load_tables, BSR_DB::get_sizes

patrickebates added a commit that referenced this issue Feb 8, 2017
@evilzenscientist
Copy link
Author

Slowly getting there. Now it sees the tables; throws error 2715 on the search:

[07-Feb-2017 07:43:47 UTC] WordPress database error [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Column, parameter, or variable #4: Cannot find data type boolean. Code - 2715 for query CREATE TABLE wp_cpk_wpcsv_export_queue (
id int NOT NULL IDENTITY(1,1),
export_id NVARCHAR(30) NOT NULL,
post_id int NOT NULL,
done boolean NOT NULL DEFAULT 0,
msg NVARCHAR(255) NULL,
CONSTRAINT [wp_cpk_wpcsv_export_queue_id] PRIMARY KEY CLUSTERED (id) WITH (IGNORE_DUP_KEY = OFF)

@evilzenscientist
Copy link
Author

I resorted to hand crafted SQL to do my fixup for my move. There's still some broken in these migration plugins - would be super helpful for others if they can be fixed. Makes migration from LAMP to Azure easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants