Changeset 7718
- Timestamp:
- 10/04/2018 09:21:01 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/cli-commands.php
r7717 r7718 141 141 } 142 142 143 /** 144 * Returns information pertaining to the last parsing. 145 * 146 * ## OPTIONS 147 * 148 * <key> 149 * : The information from the last parsing to obtain. One of: 'date', 'import-dir', 'version'. 150 * 151 * ## EXAMPLES 152 * 153 * wp devhub last-parsed version 154 * 155 * @when after_wp_load 156 * @subcommand last-parsed 157 */ 158 public function last_parsed( $args, $assoc_args ) { 159 list( $key ) = $args; 160 161 $valid_values = array( 162 'date' => 'wp_parser_last_import', 163 'import-dir' => 'wp_parser_root_import_dir', 164 'version' => 'wp_parser_imported_wp_version', 165 ); 166 167 if ( empty( $valid_values[ $key ] ) ) { 168 WP_CLI::error( 'Invalid value provided. Must be one of: ' . implode( ', ', array_keys( $valid_values ) ) ); 169 } 170 171 $option = $valid_values[ $key ]; 172 173 $value = get_option( $option ); 174 175 if ( 'date' === $key ) { 176 $value = date_i18n( 'Y-m-d H:i', $value ); 177 } 178 179 if ( ! $value ) { 180 WP_CLI::error( 'No value from previous parsing of WordPress source was detected.' ); 181 } else { 182 WP_CLI::log( $value ); 183 } 184 } 185 143 186 } 144 187
Note: See TracChangeset
for help on using the changeset viewer.