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

Set sql-mode to '' #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions drupal2wp/inc/Drupal2WordPressDrupalImporter_7.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public function getTerms() {
* Runs check and processes terms import
*/
public function importTerms() {
echo "Import terms was executed";
return;
if (!empty($this->options['terms'])) {
$this->_importTags();
$this->_importCategories();
Expand Down Expand Up @@ -243,7 +245,7 @@ private function _importTags() {
} else {
print '<p><span style="color: maroon;">'.__('Tags Failed to Import', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output

$drupal_tags = $drupal_taxonomy = NULL;
unset($drupal_tags, $drupal_taxonomy);
Expand Down Expand Up @@ -291,7 +293,7 @@ private function _importCategories() {
} else {
print '<p><span style="color: maroon;">'.__('Categories Failed to Import', 'drupal2wp').' - '.__('All failed', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output

}

Expand All @@ -300,6 +302,7 @@ private function _importCategories() {
*/
public function importContent() {
if (!empty($this->options['content'])) {
echo "import Content";
$this->_importContentTypes();
$this->_importTagsAndRelationships();
$this->_updatePostType();
Expand Down Expand Up @@ -366,7 +369,7 @@ private function _importContentTypes() {
} else {
print '<p><span style="color: maroon;">'.__('Content Failed to Import', 'drupal2wp').' - '.__('All failed', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand Down Expand Up @@ -600,7 +603,7 @@ private function _importTagsAndRelationships() {
} else {
print '<p><span style="color: maroon;">'.__('Tags & Content Relationships Failed to Import', 'drupal2wp').' - '.__('All failed', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand Down Expand Up @@ -628,7 +631,7 @@ public function updateTermsCount() {
} else {
print '<p><span style="color: maroon;">'.__('Tag Count Failed to Update', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand All @@ -654,7 +657,7 @@ private function _updatePostType() {
} else {
print '<p><span style="color: maroon;">'.__('Posted Type Failed to Update', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand All @@ -676,7 +679,7 @@ private function _importComments() {
private function _importCommentsData() {
$this->_processCommentsLevel();
print '<p><span style="color: green;">'.__('Comments Imported', 'drupal2wp').'</span></p>';
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand Down Expand Up @@ -768,7 +771,7 @@ private function _importCommentsCount() {
} else {
print '<p><span style="color: maroon;">'.__('Content Comments Count Failed to Update', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

/**
Expand All @@ -790,7 +793,7 @@ private function _importMedia() {
} else {
print '<p><span>'.__('No Media was Found for Import', 'drupal2wp').'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}else{
foreach(DrupalFileField::$media_post_data AS $post_id=>$data){
$mediaCount=count($data);
Expand Down Expand Up @@ -934,7 +937,7 @@ public function importUsers() {
$this->_importUsersData($i, $importLimit);
}
print '<p><span style="color: green;">'.sprintf(__('Users Import Complete (%d imported)', 'drupal2wp'), $totalUsers['total']).'</span></p>';
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}
}
return $this; // maintain chaining
Expand Down Expand Up @@ -1080,7 +1083,7 @@ private function _importUsersData($offset, $importLimit) {
} else {
print '<p><span style="color: maroon;">'.sprintf(__('Failed to import users: %d - %d', 'drupal2wp'), $offset, $offset+$importLimit).'</span></p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
}

}
10 changes: 4 additions & 6 deletions drupal2wp/inc/Drupal2WordPressDrupalVersionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function _fixSettings() {
if (!empty($this->options['wp_drupal_assets_url'])) {
$this->options['wp_drupal_assets_url'] = rtrim($this->options['wp_drupal_assets_url'], '/').'/';
}
do_action('drupal2wp_fix_settings', $this);
do_action('drupal2wp_fix_settings', $this);
return $this; // maintain chaining
}

Expand All @@ -173,7 +173,6 @@ public function _fixSettings() {
*/
public function _truncateWP() {
global $wpdb;

// Process options
if (!empty($this->options['terms'])) {
$wpdb->query("TRUNCATE TABLE {$wpdb->term_relationships}");
Expand All @@ -198,7 +197,7 @@ public function _truncateWP() {
do_action('drupal2wp_importer_truncate', $this);

print '<p><span style="color: green;">'.__('WordPress Tables Truncated', 'drupal2wp').'</span> - '.__('This ensures content/user IDs are synced across all systems', 'drupal2wp').'</p>';
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output //Commented out because of issues, about hanging the browser :(

return $this; // maintain chaining
}
Expand Down Expand Up @@ -349,7 +348,6 @@ public function fixAssetPathing($content) {
*/
public function fixContentMedia() {
global $wpdb;

// Fetch our posts and fix our media
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type NOT IN ('attachment', 'revision');");
foreach ($posts as $post) {
Expand Down Expand Up @@ -704,7 +702,7 @@ public function complete() {
}
}
echo '</ul>';
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
// Flush the rewrite rules to use correct permalinks
flush_rewrite_rules(true);
// Remove Session data
Expand All @@ -730,7 +728,7 @@ public function outputHtaccessRedirects() {
} else {
echo '<p>'.__('No rewrites are necessary.', 'drupal2wp').'</p>';
}
ob_flush(); flush(); // Output
//ob_flush(); flush(); // Output
return $this; // maintain chaining
}

Expand Down
3 changes: 2 additions & 1 deletion drupal2wp/inc/Drupal2WordPress_DrupalDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ private function run_query($sql,$args=array(),$mode="r"){
$query = preg_replace_callback(DB_QUERY_REGEXP, array(&$this, 'string_sanitize'), $sql['query']);
mysqli_query($conn,"SET NAMES 'utf8'");
mysqli_query($conn,"SET SQL_BIG_SELECTS=1 ");
mysqli_query($conn,"SET sql_mode=''");
$result = mysqli_query($conn, $query);

if (!$result){
if ($show_error){
echo "Error querying database. : $query<br/>";
echo "Error querying database. : $query; Error desc: ".mysqli_error($conn)."<br/>";
}
}
else{
Expand Down