From 76e809f9abb3dd691b755cf943b50a76a3ffb488 Mon Sep 17 00:00:00 2001 From: Luke Carbis Date: Fri, 2 Oct 2015 10:23:58 +1000 Subject: [PATCH] Remove migration --- classes/class-admin.php | 32 --- classes/class-migrate.php | 352 ---------------------------- languages/stream-en_US.mo | Bin 704 -> 704 bytes languages/stream-en_US.po | 374 +++++++++++++----------------- tests/tests/test-class-admin.php | 2 - tests/tests/test-class-plugin.php | 2 +- ui/css/admin.css | 45 ---- ui/js/migrate.js | 114 --------- 8 files changed, 165 insertions(+), 756 deletions(-) delete mode 100644 classes/class-migrate.php delete mode 100644 ui/js/migrate.js diff --git a/classes/class-admin.php b/classes/class-admin.php index 9e42212ae..06d241b05 100644 --- a/classes/class-admin.php +++ b/classes/class-admin.php @@ -24,11 +24,6 @@ class Admin { */ public $live_update; - /** - * @var Migrate - */ - public $migrate; - /** * Menu page screen id * @@ -183,7 +178,6 @@ public function __construct( $plugin ) { public function init() { $this->network = new Network( $this->plugin ); $this->live_update = new Live_Update( $this->plugin ); - $this->migrate = new Migrate( $this->plugin ); } /** @@ -394,32 +388,6 @@ public function admin_enqueue_scripts( $hook ) { ); } - if ( $this->migrate->show_migrate_notice() ) { - $limit = absint( $this->migrate->limit ); - $record_count = absint( $this->migrate->record_count ); - $chunks = ceil( $record_count / $limit ); - $estimated_time = ( $chunks > 1 ) ? round( ( $chunks * 5 ) / 60 ) : 0; - $migrate_time_message = ( $estimated_time > 1 ) ? sprintf( esc_html__( 'This will take about %d minutes.', 'stream' ), absint( $estimated_time ) ) : esc_html__( 'This could take a few minutes.', 'stream' ); - - wp_enqueue_script( 'wp-stream-migrate', $this->plugin->locations['url'] . 'ui/js/migrate.js', array( 'jquery' ), $this->plugin->get_version() ); - wp_localize_script( - 'wp-stream-migrate', - 'wp_stream_migrate', - array( - 'i18n' => array( - 'migrate_process_title' => esc_html__( 'Migrating Stream Records', 'stream' ), - 'ignore_migrate_title' => esc_html__( 'No Records Were Migrated', 'stream' ), - 'migrate_process_message' => esc_html__( 'Please do not exit this page until the process has completed.', 'stream' ) . ' ' . esc_html( $migrate_time_message ), - 'confirm_start_migrate' => ( $estimated_time > 1 ) ? sprintf( esc_html__( 'Please note: This process will take about %d minutes to complete.', 'stream' ), absint( $estimated_time ) ) : esc_html__( 'Please note: This process could take a few minutes to complete.', 'stream' ), - 'confirm_migrate_reminder' => esc_html__( 'Please note: Your existing records will not appear in Stream until you have migrated them to your local database.', 'stream' ), - 'confirm_ignore_migrate' => sprintf( esc_html__( 'Are you sure you want to lose all %s existing Stream records without migrating?', 'stream' ), number_format( $record_count ), ( $estimated_time > 1 && is_multisite() ) ? sprintf( esc_html__( 'about %d', 'stream' ), absint( $estimated_time ) ) : esc_html__( 'a few', 'stream' ) ), - ), - 'chunks' => absint( $chunks ), - 'nonce' => wp_create_nonce( 'wp_stream_migrate-' . absint( get_current_blog_id() ) . absint( get_current_user_id() ) ), - ) - ); - } - /** * The maximum number of items that can be updated in bulk without receiving a warning. * diff --git a/classes/class-migrate.php b/classes/class-migrate.php deleted file mode 100644 index 14581e803..000000000 --- a/classes/class-migrate.php +++ /dev/null @@ -1,352 +0,0 @@ -plugin = $plugin; - - $this->api_key = get_option( 'wp_stream_site_api_key' ); - $this->site_uuid = get_option( 'wp_stream_site_uuid' ); - - // Exit early if disconnected - if ( ! $this->is_connected() ) { - return; - } - - $this->limit = absint( apply_filters( 'wp_stream_migrate_chunk_size', 100 ) ); - - $this->record_count = $this->get_record_count(); - - // Display admin notice - add_action( 'admin_notices', array( $this, 'migrate_notice' ), 9 ); - - // AJAX callback for migrate action - add_action( 'wp_ajax_wp_stream_migrate_action', array( $this, 'migrate_action_callback' ) ); - } - - /** - * Are we currently connected to WP Stream? - * - * @return bool - */ - private function is_connected() { - return ( ! empty( $this->api_key ) && ! empty( $this->site_uuid ) ); - } - - /** - * Disconnect from WP Stream - */ - private function disconnect() { - delete_option( 'wp_stream_site_api_key' ); - delete_option( 'wp_stream_site_uuid' ); - delete_option( 'wp_stream_delay_migration' ); - delete_option( 'wp_stream_site_restricted' ); - - $this->api_key = false; - $this->site_uuid = false; - } - - /** - * Search for records - * - * @param array $query - * - * @return mixed Response body on success, or FALSE on failure - */ - private function search( $query = array() ) { - if ( ! $this->is_connected() ) { - return false; - } - - $defaults = array( - 'sort' => array( - array( - 'created' => array( - 'order' => 'asc', - ), - ), - ), - ); - - $last = get_option( 'wp_stream_last_migrated' ); - - if ( $last ) { - $defaults['filter'] = array( - 'and' => array( - array( - 'range' => array( - 'created' => array( - 'gt' => $last, - ), - ), - ), - ), - ); - } - - $body['sites'] = array( $this->site_uuid ); - $body['query'] = array_merge( $defaults, (array) $query ); - - $args = array( - 'headers' => array( - 'Stream-Site-API-Key' => $this->api_key, - 'Content-Type' => 'application/json', - ), - 'method' => 'POST', - 'body' => wp_stream_json_encode( $body ), - 'sslverify' => true, - ); - - $response = wp_safe_remote_request( 'https://api.wp-stream.com/search', $args ); - - if ( is_wp_error( $response ) ) { - return false; - } - - return json_decode( wp_remote_retrieve_body( $response ) ); - } - - /** - * Get the total number of records found - * - * @return int - */ - private function get_record_count() { - $response = $this->search( array( 'size' => 0 ) ); - - if ( empty( $response->meta->total ) ) { - return 0; - } - - return absint( $response->meta->total ); - } - - /** - * Get a chunk of records - * - * @param int $limit (optional) - * @param int $offset (optional) - * - * @return array|bool An array of record arrays, or FALSE if no records were found - */ - private function get_records( $limit = 100, $offset = 0 ) { - $limit = is_int( $limit ) ? $limit : $this->limit; - - $query = array( - 'size' => absint( $limit ), - 'from' => absint( $offset ), - ); - - $response = $this->search( $query ); - - if ( empty( $response->records ) ) { - return false; - } - - return $response->records; - } - - /** - * Determine where and when the migrate notice should be displayed - * - * @see Admin->admin_enqueue_scripts() - * - * @return bool - */ - public function show_migrate_notice() { - if ( - ! isset( $_GET['migrate_action'] ) // input var okay - && - $this->is_connected() - && - ! empty( $this->record_count ) - && - false === get_transient( 'wp_stream_delay_migration' ) - ) { - return true; - } - - return false; - } - - /** - * Give the user options for how to handle their records - * - * @action admin_notices - */ - public function migrate_notice() { - if ( ! $this->show_migrate_notice() ) { - return; - } - - $notice = sprintf( - '

%s

%s

%s

0%

%s', - __( 'Stream Records Update' ), - __( 'Our cloud storage services will be shutting down permanently on September 1, 2015', 'stream' ), - __( 'Read the announcement post', 'stream' ), - sprintf( esc_html__( 'We found %s activity records in the cloud that need to be migrated to your local database.', 'stream' ), number_format( $this->record_count ) ), - __( 'Close', 'stream' ), - __( 'Start Migration Now', 'stream' ), - __( 'Remind Me Later', 'stream' ), - __( "No thanks, I don't want to migrate", 'stream' ) - ); - - $this->plugin->admin->notice( $notice, true ); - } - - /** - * Ajax callback for processing migrate actions - * - * Break down the total number of records found into reasonably-sized - * chunks and save records from each of those chunks to the local DB. - * - * Disconnects from WP Stream once the migration is complete. - * - * @action wp_ajax_wp_stream_migrate_action - */ - public function migrate_action_callback() { - $action = wp_stream_filter_input( INPUT_POST, 'migrate_action' ); - $nonce = wp_stream_filter_input( INPUT_POST, 'nonce' ); - - if ( ! wp_verify_nonce( $nonce, 'wp_stream_migrate-' . absint( get_current_blog_id() ) . absint( get_current_user_id() ) ) ) { - return; - } - - set_time_limit( 0 ); // Just in case, this could take a while for some - - switch ( $action ) { - case 'migrate': - case 'continue': - $this->migrate(); - break; - case 'delay': - $this->delay(); - break; - case 'ignore': - $this->ignore(); - break; - } - - die(); - } - - /** - * Migrate a chunk of records - * - * @return string JSON data - */ - private function migrate() { - $records = $this->get_records( $this->limit ); - - // Disconnect when there are no records left - if ( ! $records ) { - $this->disconnect(); - - wp_send_json_success( esc_html__( 'Migration complete!', 'stream' ) ); - } - - $records_saved = $this->save_records( $records ); - - if ( true !== $records_saved ) { - wp_send_json_error( esc_html__( 'An unknown error occurred during migration. Please try again later or contact support.', 'stream' ) ); - } - - wp_send_json_success( 'continue' ); - } - - /** - * Delay the migration of records for 3 hours - * - * @return string JSON data - */ - private function delay() { - set_transient( 'wp_stream_delay_migration', "Don't nag me, bro", HOUR_IN_SECONDS * 3 ); - - wp_send_json_success( esc_html__( "OK, we'll remind you again in a few hours.", 'stream' ) ); - } - - /** - * Don't migrate any records - * - * @return string JSON data - */ - private function ignore() { - $this->disconnect(); - - wp_send_json_success( esc_html__( 'All new activity will be stored in the local database.', 'stream' ) ); - } - - /** - * Save records to the database - * - * @param array $records - * - * @return bool - */ - private function save_records( $records ) { - foreach ( $records as $record ) { - // Remove existing meta field - unset( $record->meta ); - - // Map fields to the newer data model - $record->user_id = $record->author; - $record->user_role = $record->author_role; - $record->meta = $record->stream_meta; - $record->meta->user_meta = $record->author_meta; - - // Convert the record object to a record array - // @codingStandardsIgnoreStart - $record = json_decode( json_encode( $record ), true ); - // @codingStandardsIgnoreEnd - - // Save the record - $inserted = $this->plugin->db->insert( $record ); - - // Save the date of the last known migrated record - if ( false !== $inserted ) { - update_option( 'wp_stream_last_migrated', $record['created'] ); - } - } - - return true; - } -} diff --git a/languages/stream-en_US.mo b/languages/stream-en_US.mo index ab16e5ef18536ebb491f497b36d51bac8cda9fb9..8aa0887976e1edff239487541e17c836895b3b53 100644 GIT binary patch delta 37 icmX@WdVqC84!5C!u7Qz)p@Eg5<-~GXWbVfKicA2z#tB~l delta 37 jcmX@WdVqC84!421u91;~p{bRr(Zq6DB(Cws`HD;cy>SV2 diff --git a/languages/stream-en_US.po b/languages/stream-en_US.po index 375da2504..23966281b 100644 --- a/languages/stream-en_US.po +++ b/languages/stream-en_US.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Stream\n" -"POT-Creation-Date: 2015-07-22 15:52+1000\n" -"PO-Revision-Date: 2015-07-22 15:53+1000\n" +"POT-Creation-Date: 2015-10-02 10:19+1000\n" +"PO-Revision-Date: 2015-10-02 10:19+1000\n" "Last-Translator: Luke Carbis \n" "Language-Team: Luke Carbis \n" "Language: en_US\n" @@ -22,117 +22,65 @@ msgstr "" msgid "Stream requires PHP version 5.3+, plugin is currently NOT ACTIVE." msgstr "" -#: classes/class-admin.php:201 +#: classes/class-admin.php:195 msgid "All site settings have been successfully reset." msgstr "" -#: classes/class-admin.php:276 classes/class-network.php:122 +#: classes/class-admin.php:270 classes/class-network.php:122 #: connectors/class-connector-settings.php:134 msgid "Stream" msgstr "" -#: classes/class-admin.php:292 +#: classes/class-admin.php:286 msgid "Stream Records" msgstr "" -#: classes/class-admin.php:309 +#: classes/class-admin.php:303 msgid "Stream Settings" msgstr "" -#: classes/class-admin.php:314 classes/class-admin.php:691 +#: classes/class-admin.php:308 classes/class-admin.php:662 #: connectors/class-connector-settings.php:105 #: connectors/class-connector-settings.php:126 -#: connectors/class-connector-woocommerce.php:724 +#: connectors/class-connector-woocommerce.php:728 msgid "Settings" msgstr "" -#: classes/class-admin.php:375 +#: classes/class-admin.php:369 msgid "" "Are you sure you want to delete all Stream activity records from the " "database? This cannot be undone." msgstr "" -#: classes/class-admin.php:376 +#: classes/class-admin.php:370 msgid "" "Are you sure you want to reset all site settings to default? This cannot be " "undone." msgstr "" -#: classes/class-admin.php:377 +#: classes/class-admin.php:371 msgid "" "Are you sure you want to uninstall and deactivate Stream? This will delete " "all Stream tables from the database and cannot be undone." msgstr "" -#: classes/class-admin.php:402 -#, php-format -msgid "This will take about %d minutes." -msgstr "" - -#: classes/class-admin.php:402 -msgid "This could take a few minutes." -msgstr "" - -#: classes/class-admin.php:410 -msgid "Migrating Stream Records" -msgstr "" - -#: classes/class-admin.php:411 -msgid "No Records Were Migrated" -msgstr "" - #: classes/class-admin.php:412 -msgid "Please do not exit this page until the process has completed." -msgstr "" - -#: classes/class-admin.php:413 -#, php-format -msgid "Please note: This process will take about %d minutes to complete." -msgstr "" - -#: classes/class-admin.php:413 -msgid "Please note: This process could take a few minutes to complete." -msgstr "" - -#: classes/class-admin.php:414 -msgid "" -"Please note: Your existing records will not appear in Stream until you have " -"migrated them to your local database." -msgstr "" - -#: classes/class-admin.php:415 -#, php-format -msgid "" -"Are you sure you want to lose all %s existing Stream records without " -"migrating?" -msgstr "" - -#: classes/class-admin.php:415 -#, php-format -msgid "about %d" -msgstr "" - -#: classes/class-admin.php:415 -msgid "a few" -msgstr "" - -#: classes/class-admin.php:444 #, php-format msgid "" "Are you sure you want to perform bulk actions on over %s items? This process " "could take a while to complete." msgstr "" -#: classes/class-admin.php:579 classes/class-uninstall.php:51 +#: classes/class-admin.php:546 classes/class-uninstall.php:51 msgid "You don't have sufficient privileges to do this action." msgstr "" -#: classes/class-admin.php:701 +#: classes/class-admin.php:672 msgid "Uninstall" msgstr "" #: classes/class-author.php:82 classes/class-author.php:90 -#: classes/class-settings.php:771 +#: classes/class-settings.php:779 msgid "N/A" msgstr "" @@ -144,7 +92,7 @@ msgstr "" msgid "during WP Cron" msgstr "" -#: classes/class-cli.php:217 +#: classes/class-cli.php:218 msgid "SITE IS DISCONNECTED" msgstr "" @@ -223,13 +171,13 @@ msgstr "" msgid "Filter not supported." msgstr "" -#: classes/class-install.php:174 +#: classes/class-install.php:179 msgid "The following table is not present in the WordPress database:" msgid_plural "The following tables are not present in the WordPress database:" msgstr[0] "" msgstr[1] "" -#: classes/class-install.php:184 classes/class-install.php:186 +#: classes/class-install.php:189 classes/class-install.php:191 #, php-format msgid "" "Please uninstall the Stream plugin and activate it again." @@ -289,15 +237,15 @@ msgstr "" msgid "User" msgstr "" -#: classes/class-list-table.php:81 classes/class-settings.php:729 +#: classes/class-list-table.php:81 classes/class-settings.php:737 msgid "Context" msgstr "" -#: classes/class-list-table.php:82 classes/class-settings.php:730 +#: classes/class-list-table.php:82 classes/class-settings.php:738 msgid "Action" msgstr "" -#: classes/class-list-table.php:83 classes/class-settings.php:731 +#: classes/class-list-table.php:83 classes/class-settings.php:739 msgid "IP Address" msgstr "" @@ -372,8 +320,8 @@ msgid "Live updates" msgstr "" #: classes/class-list-table.php:867 classes/class-network.php:271 -#: classes/class-settings.php:269 classes/class-settings.php:299 -#: classes/class-settings.php:313 +#: classes/class-settings.php:251 classes/class-settings.php:277 +#: classes/class-settings.php:307 classes/class-settings.php:321 msgid "Enabled" msgstr "" @@ -392,57 +340,6 @@ msgid_plural "%s items" msgstr[0] "" msgstr[1] "" -#: classes/class-migrate.php:225 -msgid "" -"Our cloud storage services will be shutting down permanently on September 1, " -"2015" -msgstr "" - -#: classes/class-migrate.php:226 -msgid "Read the announcement post" -msgstr "" - -#: classes/class-migrate.php:227 -#, php-format -msgid "" -"We found %s activity records in the cloud that need to be migrated to your " -"local database." -msgstr "" - -#: classes/class-migrate.php:228 -msgid "Close" -msgstr "" - -#: classes/class-migrate.php:229 -msgid "Start Migration Now" -msgstr "" - -#: classes/class-migrate.php:230 -msgid "Remind Me Later" -msgstr "" - -#: classes/class-migrate.php:231 -msgid "No thanks, I don't want to migrate" -msgstr "" - -#: classes/class-migrate.php:285 -msgid "Migration complete!" -msgstr "" - -#: classes/class-migrate.php:291 -msgid "" -"An unknown error occurred during migration. Please try again later or " -"contact support." -msgstr "" - -#: classes/class-migrate.php:305 -msgid "OK, we'll remind you again in a few hours." -msgstr "" - -#: classes/class-migrate.php:316 -msgid "All new activity will be stored in the local database." -msgstr "" - #: classes/class-network.php:78 msgid "Network Admin" msgstr "" @@ -544,119 +441,131 @@ msgid "Keep Records for" msgstr "" #: classes/class-settings.php:239 -msgid "" -"Maximum number of days to keep activity records. Leave blank to keep records " -"forever." +msgid "Maximum number of days to keep activity records." msgstr "" #: classes/class-settings.php:244 msgid "days" msgstr "" -#: classes/class-settings.php:249 +#: classes/class-settings.php:248 +msgid "Keep Records Indefinitely" +msgstr "" + +#: classes/class-settings.php:250 +msgid "Not recommended." +msgstr "" + +#: classes/class-settings.php:250 +msgid "" +"Purging old records helps to keep your WordPress installation running " +"optimally." +msgstr "" + +#: classes/class-settings.php:257 msgid "Exclude" msgstr "" -#: classes/class-settings.php:253 +#: classes/class-settings.php:261 msgid "Exclude Rules" msgstr "" -#: classes/class-settings.php:255 +#: classes/class-settings.php:263 msgid "" "Create rules to exclude certain kinds of activity from being recorded by " "Stream." msgstr "" -#: classes/class-settings.php:262 +#: classes/class-settings.php:270 msgid "Advanced" msgstr "" -#: classes/class-settings.php:266 +#: classes/class-settings.php:274 msgid "Comment Flood Tracking" msgstr "" -#: classes/class-settings.php:268 +#: classes/class-settings.php:276 msgid "" "WordPress will automatically prevent duplicate comments from flooding the " "database. By default, Stream does not track these attempts unless you opt-in " "here. Enabling this is not necessary or recommended for most sites." msgstr "" -#: classes/class-settings.php:274 +#: classes/class-settings.php:282 msgid "Reset Stream Database" msgstr "" -#: classes/class-settings.php:284 +#: classes/class-settings.php:292 msgid "Warning: This will delete all activity records from the database." msgstr "" -#: classes/class-settings.php:296 +#: classes/class-settings.php:304 msgid "Akismet Tracking" msgstr "" -#: classes/class-settings.php:298 +#: classes/class-settings.php:306 msgid "" "Akismet already keeps statistics for comment attempts that it blocks as " "SPAM. By default, Stream does not track these attempts unless you opt-in " "here. Enabling this is not necessary or recommended for most sites." msgstr "" -#: classes/class-settings.php:310 +#: classes/class-settings.php:318 msgid "WP Cron Tracking" msgstr "" -#: classes/class-settings.php:312 +#: classes/class-settings.php:320 msgid "" "By default, Stream does not track activity performed by WordPress cron " "events unless you opt-in here. Enabling this is not necessary or recommended " "for most sites." msgstr "" -#: classes/class-settings.php:695 +#: classes/class-settings.php:703 #, php-format msgid "Any %s" msgstr "" -#: classes/class-settings.php:710 +#: classes/class-settings.php:718 msgid "Add New Rule" msgstr "" -#: classes/class-settings.php:711 +#: classes/class-settings.php:719 msgid "Delete Selected Rules" msgstr "" -#: classes/class-settings.php:728 +#: classes/class-settings.php:736 msgid "Author or Role" msgstr "" -#: classes/class-settings.php:732 +#: classes/class-settings.php:740 msgid "Filters" msgstr "" -#: classes/class-settings.php:758 +#: classes/class-settings.php:766 #, php-format msgid "1 user" msgid_plural "%s users" msgstr[0] "" msgstr[1] "" -#: classes/class-settings.php:784 +#: classes/class-settings.php:792 msgid "Any Author or Role" msgstr "" -#: classes/class-settings.php:825 +#: classes/class-settings.php:833 msgid "Any Context" msgstr "" -#: classes/class-settings.php:844 +#: classes/class-settings.php:852 msgid "Any Action" msgstr "" -#: classes/class-settings.php:855 +#: classes/class-settings.php:863 msgid "Any IP Address" msgstr "" -#: classes/class-settings.php:892 +#: classes/class-settings.php:900 msgid "No rules found." msgstr "" @@ -1266,8 +1175,8 @@ msgstr "" #: connectors/class-connector-edd.php:248 #: connectors/class-connector-edd.php:293 #: connectors/class-connector-gravityforms.php:481 -#: connectors/class-connector-jetpack.php:493 -#: connectors/class-connector-jetpack.php:668 +#: connectors/class-connector-jetpack.php:502 +#: connectors/class-connector-jetpack.php:677 #, php-format msgid "\"%s\" setting updated" msgstr "" @@ -1277,8 +1186,8 @@ msgstr "" #: connectors/class-connector-gravityforms.php:353 #: connectors/class-connector-gravityforms.php:399 #: connectors/class-connector-gravityforms.php:649 -#: connectors/class-connector-jetpack.php:330 -#: connectors/class-connector-jetpack.php:434 +#: connectors/class-connector-jetpack.php:341 +#: connectors/class-connector-jetpack.php:443 msgid "activated" msgstr "" @@ -1286,8 +1195,8 @@ msgstr "" #: connectors/class-connector-edd.php:365 #: connectors/class-connector-gravityforms.php:353 #: connectors/class-connector-gravityforms.php:399 -#: connectors/class-connector-jetpack.php:330 -#: connectors/class-connector-jetpack.php:434 +#: connectors/class-connector-jetpack.php:341 +#: connectors/class-connector-jetpack.php:443 msgid "deactivated" msgstr "" @@ -2402,133 +2311,133 @@ msgstr "" msgid "Tiled Galleries" msgstr "" -#: connectors/class-connector-jetpack.php:328 +#: connectors/class-connector-jetpack.php:339 #, php-format msgid "%1$s module %2$s" msgstr "" -#: connectors/class-connector-jetpack.php:346 +#: connectors/class-connector-jetpack.php:357 #, php-format msgid "%1$s's account %2$s %3$s Jetpack" msgstr "" -#: connectors/class-connector-jetpack.php:348 +#: connectors/class-connector-jetpack.php:359 msgid "unlinked" msgstr "" -#: connectors/class-connector-jetpack.php:348 +#: connectors/class-connector-jetpack.php:359 msgid "linked" msgstr "" -#: connectors/class-connector-jetpack.php:349 +#: connectors/class-connector-jetpack.php:360 msgid "from" msgstr "" -#: connectors/class-connector-jetpack.php:349 +#: connectors/class-connector-jetpack.php:360 msgid "to" msgstr "" -#: connectors/class-connector-jetpack.php:365 +#: connectors/class-connector-jetpack.php:374 #, php-format msgid "Site %s Jetpack" msgstr "" -#: connectors/class-connector-jetpack.php:366 -#: connectors/class-connector-jetpack.php:376 +#: connectors/class-connector-jetpack.php:375 +#: connectors/class-connector-jetpack.php:385 msgid "connected to" msgstr "" -#: connectors/class-connector-jetpack.php:366 -#: connectors/class-connector-jetpack.php:376 +#: connectors/class-connector-jetpack.php:375 +#: connectors/class-connector-jetpack.php:385 msgid "disconnected from" msgstr "" -#: connectors/class-connector-jetpack.php:374 +#: connectors/class-connector-jetpack.php:383 #, php-format msgid "\"%1$s\" blog %2$s Jetpack" msgstr "" -#: connectors/class-connector-jetpack.php:401 +#: connectors/class-connector-jetpack.php:410 msgid "Sharing services updated" msgstr "" -#: connectors/class-connector-jetpack.php:432 +#: connectors/class-connector-jetpack.php:441 #, php-format msgid "Monitor notifications %s" msgstr "" -#: connectors/class-connector-jetpack.php:459 -#: connectors/class-connector-jetpack.php:550 +#: connectors/class-connector-jetpack.php:468 +#: connectors/class-connector-jetpack.php:559 msgid "enabled" msgstr "" -#: connectors/class-connector-jetpack.php:461 -#: connectors/class-connector-jetpack.php:550 +#: connectors/class-connector-jetpack.php:470 +#: connectors/class-connector-jetpack.php:559 msgid "disabled" msgstr "" -#: connectors/class-connector-jetpack.php:463 +#: connectors/class-connector-jetpack.php:472 msgid "regenerated" msgstr "" -#: connectors/class-connector-jetpack.php:469 +#: connectors/class-connector-jetpack.php:478 #, php-format msgid "%1$s %2$s Post by Email" msgstr "" -#: connectors/class-connector-jetpack.php:548 +#: connectors/class-connector-jetpack.php:557 #, php-format msgid "G+ profile display %s" msgstr "" -#: connectors/class-connector-jetpack.php:565 +#: connectors/class-connector-jetpack.php:574 #, php-format msgid "%1$s's Google+ account %2$s" msgstr "" -#: connectors/class-connector-jetpack.php:568 +#: connectors/class-connector-jetpack.php:577 msgid "connected" msgstr "" -#: connectors/class-connector-jetpack.php:568 +#: connectors/class-connector-jetpack.php:577 msgid "disconnected" msgstr "" -#: connectors/class-connector-jetpack.php:585 +#: connectors/class-connector-jetpack.php:594 #, php-format msgid "Sharing CSS/JS %s" msgstr "" -#: connectors/class-connector-jetpack.php:624 +#: connectors/class-connector-jetpack.php:633 msgid "Custom CSS updated" msgstr "" -#: connectors/class-connector-jetpack.php:644 +#: connectors/class-connector-jetpack.php:653 #, php-format msgid "%1$s connection %2$s" msgstr "" -#: connectors/class-connector-jetpack.php:647 +#: connectors/class-connector-jetpack.php:656 msgid "added" msgstr "" -#: connectors/class-connector-jetpack.php:647 +#: connectors/class-connector-jetpack.php:656 msgid "removed" msgstr "" -#: connectors/class-connector-jetpack.php:657 +#: connectors/class-connector-jetpack.php:666 msgid "Video Library Access" msgstr "" -#: connectors/class-connector-jetpack.php:658 +#: connectors/class-connector-jetpack.php:667 msgid "Allow users to upload videos" msgstr "" -#: connectors/class-connector-jetpack.php:659 +#: connectors/class-connector-jetpack.php:668 msgid "Free formats" msgstr "" -#: connectors/class-connector-jetpack.php:660 +#: connectors/class-connector-jetpack.php:669 msgid "Default quality" msgstr "" @@ -3144,8 +3053,29 @@ msgctxt "1: Term name, 2: Taxonomy singular label" msgid "\"%1$s\" %2$s updated" msgstr "" +#: connectors/class-connector-user-switching.php:44 +msgctxt "user-switching" +msgid "User Switching" +msgstr "" + +#: connectors/class-connector-user-switching.php:144 +#, php-format +msgctxt "1: User display name, 2: User login" +msgid "Switched user to %1$s (%2$s)" +msgstr "" + +#: connectors/class-connector-user-switching.php:174 +#, php-format +msgctxt "1: User display name, 2: User login" +msgid "Switched back to %1$s (%2$s)" +msgstr "" + +#: connectors/class-connector-user-switching.php:208 +msgid "Switched off" +msgstr "" + #: connectors/class-connector-users.php:41 -#: connectors/class-connector-users.php:68 +#: connectors/class-connector-users.php:71 msgid "Users" msgstr "" @@ -3165,66 +3095,78 @@ msgstr "" msgid "Log Out" msgstr "" -#: connectors/class-connector-users.php:69 +#: connectors/class-connector-users.php:58 +msgid "Switched To" +msgstr "" + +#: connectors/class-connector-users.php:59 +msgid "Switched Back" +msgstr "" + +#: connectors/class-connector-users.php:60 +msgid "Switched Off" +msgstr "" + +#: connectors/class-connector-users.php:72 msgid "Sessions" msgstr "" -#: connectors/class-connector-users.php:70 +#: connectors/class-connector-users.php:73 msgid "Profiles" msgstr "" -#: connectors/class-connector-users.php:87 +#: connectors/class-connector-users.php:90 msgid "Edit User" msgstr "" -#: connectors/class-connector-users.php:136 +#: connectors/class-connector-users.php:139 msgid "New user registration" msgstr "" -#: connectors/class-connector-users.php:140 +#: connectors/class-connector-users.php:143 #, php-format msgctxt "1: User display name, 2: User role" msgid "New user account created for %1$s (%2$s)" msgstr "" -#: connectors/class-connector-users.php:172 +#: connectors/class-connector-users.php:175 #, php-format msgid "%s's profile was updated" msgstr "" -#: connectors/class-connector-users.php:200 +#: connectors/class-connector-users.php:203 #, php-format msgctxt "1: User display name, 2: Old role, 3: New role" msgid "%1$s's role was changed from %2$s to %3$s" msgstr "" -#: connectors/class-connector-users.php:224 +#: connectors/class-connector-users.php:227 #, php-format msgid "%s's password was reset" msgstr "" -#: connectors/class-connector-users.php:250 +#: connectors/class-connector-users.php:253 #, php-format msgid "%s's password was requested to be reset" msgstr "" -#: connectors/class-connector-users.php:276 +#: connectors/class-connector-users.php:279 #, php-format msgid "%s logged in" msgstr "" -#: connectors/class-connector-users.php:299 +#: connectors/class-connector-users.php:302 #, php-format msgid "%s logged out" msgstr "" -#: connectors/class-connector-users.php:335 +#: connectors/class-connector-users.php:338 #, php-format msgctxt "1: User display name, 2: User roles" msgid "%1$s's account was deleted (%2$s)" msgstr "" -#: connectors/class-connector-users.php:343 +#: connectors/class-connector-users.php:346 #, php-format msgid "User account #%d was deleted" msgstr "" @@ -3498,7 +3440,7 @@ msgstr "" #: connectors/class-connector-woocommerce.php:159 #: connectors/class-connector-woocommerce.php:166 #: connectors/class-connector-woocommerce.php:173 -#: connectors/class-connector-woocommerce.php:713 +#: connectors/class-connector-woocommerce.php:717 msgid "setting" msgstr "" @@ -3625,24 +3567,24 @@ msgctxt "Tax rate name" msgid "\"%s\" tax rate deleted" msgstr "" -#: connectors/class-connector-woocommerce.php:642 +#: connectors/class-connector-woocommerce.php:646 #, php-format msgid "\"%1$s\" %2$s updated" msgstr "" -#: connectors/class-connector-woocommerce.php:740 +#: connectors/class-connector-woocommerce.php:744 msgid "payment gateway" msgstr "" -#: connectors/class-connector-woocommerce.php:759 +#: connectors/class-connector-woocommerce.php:763 msgid "shipping method" msgstr "" -#: connectors/class-connector-woocommerce.php:778 +#: connectors/class-connector-woocommerce.php:782 msgid "email" msgstr "" -#: connectors/class-connector-woocommerce.php:786 +#: connectors/class-connector-woocommerce.php:790 msgid "Tools" msgstr "" @@ -4152,3 +4094,15 @@ msgstr "" #: includes/feeds/atom.php:7 includes/feeds/rss-2.0.php:21 msgid "Stream Feed" msgstr "" + +#: tests/tests/test-class-connector.php:191 +msgid "Maintenance" +msgstr "" + +#: tests/tests/test-class-connector.php:201 +msgid "Fault" +msgstr "" + +#: tests/tests/test-class-connector.php:212 +msgid "AE35 Unit" +msgstr "" diff --git a/tests/tests/test-class-admin.php b/tests/tests/test-class-admin.php index e1df9def1..02dd158b2 100644 --- a/tests/tests/test-class-admin.php +++ b/tests/tests/test-class-admin.php @@ -44,11 +44,9 @@ public function test_init() { $this->admin->init(); $this->assertNotEmpty( $this->admin->network ); $this->assertNotEmpty( $this->admin->live_update ); - $this->assertNotEmpty( $this->admin->migrate ); $this->assertInstanceOf( '\WP_Stream\Network', $this->admin->network ); $this->assertInstanceOf( '\WP_Stream\Live_Update', $this->admin->live_update ); - $this->assertInstanceOf( '\WP_Stream\Migrate', $this->admin->migrate ); } public function test_prepare_admin_notices() { diff --git a/tests/tests/test-class-plugin.php b/tests/tests/test-class-plugin.php index 4ee83129b..ce7ccfa35 100644 --- a/tests/tests/test-class-plugin.php +++ b/tests/tests/test-class-plugin.php @@ -26,7 +26,7 @@ public function test_construct() { } public function test_autoload() { - $this->assertTrue( class_exists( '\WP_Stream\Migrate' ) ); + $this->assertTrue( class_exists( '\WP_Stream\Admin' ) ); $this->assertFalse( class_exists( '\WP_Stream\HAL9000' ) ); } diff --git a/ui/css/admin.css b/ui/css/admin.css index 44a20153f..fbf7538e1 100644 --- a/ui/css/admin.css +++ b/ui/css/admin.css @@ -469,48 +469,3 @@ .post-type-stream_notification .view-switch { display: none; } - - -/* Stream Migrate Message */ - -#stream-migrate-progress { - display: none; - height: 36px; - padding: 5px 0; -} - -#stream-migrate-progress progress { - width: 300px; - font-size: 18px; -} - -#stream-migrate-progress strong, -#stream-migrate-progress #stream-migrate-actions-close { - display: none; -} - -#stream-migrate-progress strong { - padding-left: 5px; -} - -#stream-migrate-progress strong, -#stream-migrate-progress em { - line-height: 28px; - padding-right: 10px; -} - -#stream-migrate-actions .button { - display: inline-block; - vertical-align: bottom !important; - margin: 0 10px 5px 0 !important; -} - -#stream-ignore-migrate { - display: inline-block; - margin: 10px 0 5px; - color: #a00; -} - -#stream-ignore-migrate:hover { - color: #f00; -} diff --git a/ui/js/migrate.js b/ui/js/migrate.js deleted file mode 100644 index 5a2b8722e..000000000 --- a/ui/js/migrate.js +++ /dev/null @@ -1,114 +0,0 @@ -/* globals wp_stream_migrate, ajaxurl */ -jQuery( function( $ ) { - - var chunks = parseInt( wp_stream_migrate.chunks, 10 ), - progress_step = ( chunks > 1 ) ? 100 / chunks : 100, - progress_val = 0; - - $( document ).on( 'click', '#stream-start-migrate', function( e ) { - if ( ! window.confirm( wp_stream_migrate.i18n.confirm_start_migrate ) ) { - e.preventDefault(); - } else { - stream_migrate_action( 'migrate' ); - } - }); - - $( document ).on( 'click', '#stream-migrate-reminder', function( e ) { - if ( ! window.confirm( wp_stream_migrate.i18n.confirm_migrate_reminder ) ) { - e.preventDefault(); - } else { - stream_migrate_action( 'delay' ); - } - }); - - $( document ).on( 'click', '#stream-ignore-migrate', function( e ) { - if ( ! window.confirm( wp_stream_migrate.i18n.confirm_ignore_migrate ) ) { - e.preventDefault(); - } else { - stream_migrate_action( 'ignore' ); - } - }); - - $( document ).on( 'click', '#stream-migrate-actions-close', function() { - location.reload( true ); - }); - - function stream_migrate_action( migrate_action ) { - var data = { - 'action': 'wp_stream_migrate_action', - 'migrate_action': migrate_action, - 'nonce': wp_stream_migrate.nonce - }; - - $.ajax({ - type: 'POST', - url: ajaxurl, - data: data, - dataType: 'json', - beforeSend: function() { - stream_migrate_start( migrate_action ); - }, - success: function( response ) { - if ( false === response.success ) { - stream_migrate_end( response.data, true ); - } else { - if ( 'migrate' === response.data || 'continue' === response.data ) { - stream_migrate_progress_loop( response.data ); - } else { - stream_migrate_end( response.data ); - } - } - }, - error: function() { - stream_migrate_end( wp_stream_migrate.i18n.error_message, true ); - } - }); - } - - function stream_migrate_progress_loop( migrate_action ) { - progress_val = ( ( progress_step + progress_val ) < 100 ) ? progress_step + progress_val : 100; - - $( '#stream-migrate-progress progress' ).val( progress_val ); - $( '#stream-migrate-progress strong' ).text( Math.round( progress_val ) + '%' ); - - stream_migrate_action( migrate_action ); - } - - function stream_migrate_start( migrate_action ) { - $( '#stream-migrate-actions' ).hide(); - $( '#stream-migrate-blog-link' ).hide(); - $( '#stream-migrate-progress' ).show(); - - if ( 'migrate' !== migrate_action && 'continue' !== migrate_action ) { - $( '#stream-migrate-title' ).text( wp_stream_migrate.i18n.ignore_migrate_title ); - $( '#stream-migrate-message' ).hide(); - $( '#stream-migrate-progress progress' ).hide(); - $( '#stream-migrate-progress strong' ).hide(); - } - - if ( 'migrate' === migrate_action || 'continue' === migrate_action ) { - $( '#stream-migrate-title' ).text( wp_stream_migrate.i18n.migrate_process_title ); - $( '#stream-migrate-message' ).text( wp_stream_migrate.i18n.migrate_process_message ); - $( '#stream-migrate-progress progress' ).show(); - $( '#stream-migrate-progress strong' ).show(); - } - } - - function stream_migrate_end( message, is_error ) { - is_error = 'undefined' !== typeof is_error ? is_error : false; - - $( '#stream-migrate-message' ).hide(); - $( '#stream-migrate-progress progress' ).hide(); - $( '#stream-migrate-progress strong' ).hide(); - $( '#stream-migrate-actions-close' ).show(); - - if ( message ) { - $( '#stream-migrate-progress em' ).html( message ); - - if ( is_error ) { - $( '#stream-migrate-progress em' ).css( 'color', '#a00' ); - } - } - } - -});