/** * Stop process on SQL Error, print and log error, removes the new blog * @since 0.2.0 * @param string $sql_query the query * @param string $sql_error the error */ public static function sql_error($sql_query, $sql_error) { $error_1 = 'ERROR SQL ON : ' . $sql_query; MUCD_Duplicate::write_log($error_1); $error_2 = 'WPDB ERROR : ' . $sql_error; MUCD_Duplicate::write_log($error_2); MUCD_Duplicate::write_log('Duplication interrupted on SQL ERROR'); echo '<br />Duplication failed :<br /><br />' . $error_1 . '<br /><br />' . $error_2 . '<br /><br />'; if ($log_url = MUCD_Duplicate::log_url()) { echo '<a href="' . $log_url . '">' . MUCD_NETWORK_PAGE_DUPLICATE_VIEW_LOG . '</a>'; } MUCD_Functions::remove_blog(self::$to_site_id); wp_die(); }
/** * Print result message box error / updated * @since 0.2.0 * @param array $form_message messages to print */ public static function result_message($form_message) { if (isset($form_message['error'])) { echo '<div id="message" class="error">'; echo ' <p>' . $form_message['error'] . '</p>'; echo '</div>'; } else { echo '<div id="message" class="updated">'; echo ' <p>'; echo ' <strong>' . $form_message['msg'] . ' : ' . '</strong>'; switch_to_blog($form_message['site_id']); $user = get_current_user_id(); echo ' <a href="' . get_dashboard_url($user) . '">' . MUCD_NETWORK_PAGE_DUPLICATE_DASHBOARD . '</a> - '; echo ' <a href="' . get_site_url() . '">' . MUCD_NETWORK_PAGE_DUPLICATE_VISIT . '</a> - '; echo ' <a href="' . admin_url('customize.php') . '">' . MUCD_NETWORK_CUSTOMIZE . '</a>'; if ($log_url = MUCD_Duplicate::log_url()) { echo ' - <a href="' . $log_url . '">' . MUCD_NETWORK_PAGE_DUPLICATE_VIEW_LOG . '</a>'; } restore_current_blog(); echo ' </p>'; echo '</div>'; } }
/** * Stop process on Creating dir Error, print and log error, removes the new blog * @since 0.2.0 * @param string $dir_path the path */ public static function mkdir_error($dir_path) { $error_1 = 'ERROR DURING FILE COPY : CANNOT CREATE ' . $dir_path; MUCD_Duplicate::write_log($error_1); $error_2 = sprintf(MUCD_NETWORK_PAGE_DUPLICATE_COPY_FILE_ERROR, MUCD_Functions::get_primary_upload_dir()); MUCD_Duplicate::write_log($error_2); MUCD_Duplicate::write_log('Duplication interrupted on FILE COPY ERROR'); echo '<br />Duplication failed :<br /><br />' . $error_1 . '<br /><br />' . $error_2 . '<br /><br />'; if ($log_url = MUCD_Duplicate::log_url()) { echo '<a href="' . $log_url . '">' . MUCD_NETWORK_PAGE_DUPLICATE_VIEW_LOG . '</a>'; } MUCD_Functions::remove_blog(self::$to_site_id); wp_die(); }