| @@ -66,14 +66,11 @@ | ||
| 66 | 66 | WP_CLI::error( 'Invalid import file' ); |
| 67 | 67 | } |
| 68 | 68 | } else { |
| 69 | 69 | $data = @file_get_contents( $args[0] ); |
| 70 | - | |
| 71 | 70 | if ( $data ) { |
| 72 | 71 | $count = $importer->load( $group, $args[0], $data ); |
| 73 | - WP_CLI::success( 'Imported ' . $count . ' redirects as ' . $format ); | |
| 74 | - } else { | |
| 75 | - WP_CLI::error( 'Invalid import file' ); | |
| 72 | + WP_CLI::success( 'Imported ' . $count . ' as ' . $format ); | |
| 76 | 73 | } |
| 77 | 74 | } |
| 78 | 75 | } |
| 79 | 76 | |
| @@ -145,45 +142,39 @@ | ||
| 145 | 142 | if ( $args[0] === 'install' ) { |
| 146 | 143 | Red_Database::apply_to_sites( function() { |
| 147 | 144 | $latest = Red_Database::get_latest_database(); |
| 148 | 145 | $latest->install(); |
| 149 | - | |
| 150 | - WP_CLI::success( 'Site ' . get_current_blog_id() . ' database is installed' ); | |
| 151 | 146 | } ); |
| 152 | 147 | |
| 153 | - WP_CLI::success( 'Database install finished' ); | |
| 148 | + WP_CLI::success( 'Database installed' ); | |
| 154 | 149 | } elseif ( $args[0] === 'upgrade' ) { |
| 155 | - Red_Database::apply_to_sites( function() { | |
| 156 | - $database = new Red_Database(); | |
| 157 | - $status = new Red_Database_Status(); | |
| 150 | + $database = new Red_Database(); | |
| 151 | + $status = new Red_Database_Status(); | |
| 158 | 152 | |
| 159 | - if ( ! $status->needs_updating() ) { | |
| 160 | - WP_CLI::success( 'Site ' . get_current_blog_id() . ' database is already the latest version' ); | |
| 161 | - return; | |
| 162 | - } | |
| 153 | + if ( ! $status->needs_updating() ) { | |
| 154 | + WP_CLI::success( 'Database is already the latest version' ); | |
| 155 | + return; | |
| 156 | + } | |
| 163 | 157 | |
| 164 | - $loop = 0; | |
| 158 | + $loop = 0; | |
| 165 | 159 | |
| 166 | - while ( $loop < 50 ) { | |
| 167 | - $result = $database->apply_upgrade( $status ); | |
| 168 | - $info = $status->get_json(); | |
| 160 | + while ( $loop < 50 ) { | |
| 161 | + $result = $database->apply_upgrade( $status ); | |
| 162 | + $info = $status->get_json(); | |
| 169 | 163 | |
| 170 | - if ( ! $info['inProgress'] ) { | |
| 171 | - break; | |
| 172 | - } | |
| 164 | + if ( ! $info['inProgress'] ) { | |
| 165 | + break; | |
| 166 | + } | |
| 173 | 167 | |
| 174 | - if ( $info['status'] === 'error' ) { | |
| 175 | - WP_CLI::error( 'Site ' . get_current_blog_id() . ' database failed to upgrade: ' . $info['reason'] ); | |
| 176 | - return; | |
| 177 | - } | |
| 168 | + if ( $info['status'] === 'error' ) { | |
| 169 | + WP_CLI::error( 'Database failed to upgrade: ' . $info['reason'] ); | |
| 170 | + return; | |
| 171 | + } | |
| 178 | 172 | |
| 179 | - WP_CLI::success( 'Site ' . get_current_blog_id() . ' database upgraded' ); | |
| 173 | + $loop++; | |
| 174 | + } | |
| 180 | 175 | |
| 181 | - $loop++; | |
| 182 | - } | |
| 183 | - } ); | |
| 184 | - | |
| 185 | - WP_CLI::success( 'Database upgrade finished' ); | |
| 176 | + WP_CLI::success( 'Database upgraded' ); | |
| 186 | 177 | } elseif ( $args[0] === 'remove' ) { |
| 187 | 178 | Red_Database::apply_to_sites( function() { |
| 188 | 179 | $latest = Red_Database::get_latest_database(); |
| 189 | 180 | $latest->remove(); |