Changeset 9210
- Timestamp:
- 10/19/2019 11:56:48 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-make-core-pot.php
r9209 r9210 36 36 * <destination> 37 37 * : Directory to store resulting POT files. 38 *39 * [--dry-run]40 * : Run without creating POT files.41 38 */ 42 39 public function __invoke( $args, $assoc_args ) { … … 64 61 ); 65 62 66 // Continents and cities. 67 $command = 'i18n make-pot ' . escapeshellarg( $this->source ); 68 $command .= ' ' . escapeshellarg( $this->destination . '/wordpress-continents-cities.pot' ); 69 $command .= ' --include="wp-admin/includes/continents-cities.php"'; 70 $command .= ' --package-name=' . escapeshellarg( self::PACKAGE_NAME ); 71 $command .= ' --headers=' . escapeshellarg( $headers ); 72 $command .= ' --file-comment=' . escapeshellarg( $file_comment ); 73 $command .= ' --skip-js'; 74 $command .= ' --skip-audit'; 75 $command .= ' --ignore-domain'; 76 77 WP_CLI::line( $command ); 78 ! $dry_run && WP_CLI::runcommand( $command ); 63 $command_args = [ 64 'i18n', 65 'make-pot', 66 $this->source, 67 $this->destination . '/wordpress-continents-cities.pot', 68 ]; 69 70 $command_assoc_args = [ 71 'include' => 'wp-admin/includes/continents-cities.php', 72 'package-name' => self::PACKAGE_NAME, 73 'headers' => $headers, 74 'file-comment' => $file_comment, 75 'skip-js' => true, 76 'skip-audit' => true, 77 'ignore-domain' => true, 78 ]; 79 80 WP_CLI::run_command( $command_args, $command_assoc_args ); 79 81 80 82 // Front end. … … 121 123 } 122 124 123 $command = 'i18n make-pot ' . escapeshellarg( $this->source ); 124 $command .= ' ' . escapeshellarg( $this->destination . '/wordpress.pot' ); 125 $command .= ' --exclude=' . escapeshellarg( implode( ',', $front_end_exclude ) ); 126 $command .= ' --package-name=' . escapeshellarg( self::PACKAGE_NAME ); 127 $command .= ' --headers=' . escapeshellarg( $headers ); 128 $command .= ' --file-comment=' . escapeshellarg( $file_comment ); 129 $command .= ' --skip-audit'; 130 $command .= ' --ignore-domain'; 125 $command_args = [ 126 'i18n', 127 'make-pot', 128 $this->source, 129 $this->destination . '/wordpress.pot', 130 ]; 131 132 $command_assoc_args = [ 133 'exclude' => implode( ',', $front_end_exclude ), 134 'package-name' => self::PACKAGE_NAME, 135 'headers' => $headers, 136 'file-comment' => $file_comment, 137 'skip-audit' => true, 138 'ignore-domain' => true, 139 ]; 131 140 132 141 if ( version_compare( $wp_version, '5.0-beta', '<' ) ) { 133 $command .= ' --skip-js'; 134 } 135 136 WP_CLI::line( $command ); 137 ! $dry_run && WP_CLI::runcommand( $command ); 142 $command_assoc_args['skip-js'] = true; 143 } 144 145 WP_CLI::run_command( $command_args, $command_assoc_args ); 138 146 139 147 // Hello Dolly, included in admin. 140 148 $hello_dolly_pot = wp_tempnam( 'hello-dolly.pot' ); 141 149 142 $command = 'i18n make-pot ' . escapeshellarg( $this->source . '/wp-content/plugins' ); 143 $command .= ' ' . escapeshellarg( $hello_dolly_pot ); 144 $command .= ' --exclude="akismet/*"'; 145 $command .= ' --include="hello.php"'; 146 $command .= ' --package-name=' . escapeshellarg( self::PACKAGE_NAME ); 147 $command .= ' --headers=' . escapeshellarg( $headers ); 148 $command .= ' --file-comment=' . escapeshellarg( $file_comment ); 149 $command .= ' --skip-js'; 150 $command .= ' --skip-audit'; 151 $command .= ' --ignore-domain'; 152 153 WP_CLI::line( $command ); 154 ! $dry_run && WP_CLI::runcommand( $command ); 150 $command_args = [ 151 'i18n', 152 'make-pot', 153 $this->source . '/wp-content/plugins', 154 $hello_dolly_pot, 155 ]; 156 157 $command_assoc_args = [ 158 'exclude' => 'akismet/*', 159 'include' => 'hello.php', 160 'package-name' => self::PACKAGE_NAME, 161 'headers' => $headers, 162 'file-comment' => $file_comment, 163 'skip-js' => true, 164 'skip-audit' => true, 165 'ignore-domain' => true, 166 ]; 167 168 WP_CLI::run_command( $command_args, $command_assoc_args ); 155 169 156 170 // Admin. … … 178 192 $admin_exclude = array_merge( $admin_exclude, $admin_network_files ); 179 193 180 $command = 'i18n make-pot ' . escapeshellarg( $this->source ); 181 $command .= ' ' . escapeshellarg( $this->destination . '/wordpress-admin.pot' ); 182 $command .= ' --exclude=' . escapeshellarg( implode( ',', $admin_exclude ) ); 183 $command .= ' --include="wp-admin/*"'; 184 $command .= ' --merge=' . escapeshellarg( $hello_dolly_pot ); 185 $command .= ' --subtract=' . escapeshellarg( $this->destination . '/wordpress.pot' ); 186 $command .= ' --package-name=' . escapeshellarg( self::PACKAGE_NAME ); 187 $command .= ' --headers=' . escapeshellarg( $headers ); 188 $command .= ' --file-comment=' . escapeshellarg( $file_comment ); 189 $command .= ' --skip-audit'; 190 $command .= ' --ignore-domain'; 194 $command_args = [ 195 'i18n', 196 'make-pot', 197 $this->source, 198 $this->destination . '/wordpress-admin.pot', 199 ]; 200 201 $command_assoc_args = [ 202 'exclude' => implode( ',', $admin_exclude ), 203 'include' => 'wp-admin/*', 204 'merge' => $hello_dolly_pot, 205 'subtract' => $this->destination . '/wordpress.pot', 206 'package-name' => self::PACKAGE_NAME, 207 'headers' => $headers, 208 'file-comment' => $file_comment, 209 'skip-audit' => true, 210 'ignore-domain' => true, 211 ]; 191 212 192 213 if ( version_compare( $wp_version, '5.2-beta', '<' ) ) { 193 $command .= ' --skip-js'; 194 } 195 196 WP_CLI::line( $command ); 197 ! $dry_run && WP_CLI::runcommand( $command ); 214 $command_assoc_args['skip-js'] = true; 215 } 216 217 WP_CLI::run_command( $command_args, $command_assoc_args ); 198 218 199 219 unlink( $hello_dolly_pot ); 200 220 201 221 // Admin Network. 202 $command = 'i18n make-pot ' . escapeshellarg( $this->source ); 203 $command .= ' ' . escapeshellarg( $this->destination . '/wordpress-admin-network.pot' ); 204 $command .= ' --include=' . escapeshellarg( implode( ',', $admin_network_files ) ); 205 $command .= ' --subtract=' . escapeshellarg( sprintf( '%1$s/wordpress.pot,%1$s/wordpress-admin.pot', $this->destination ) ); 206 $command .= ' --package-name=' . escapeshellarg( self::PACKAGE_NAME ); 207 $command .= ' --headers=' . escapeshellarg( $headers ); 208 $command .= ' --file-comment=' . escapeshellarg( $file_comment ); 209 $command .= ' --skip-js'; // TODO: No use of wp.i18n, yet. 210 $command .= ' --skip-audit'; 211 $command .= ' --ignore-domain'; 212 213 WP_CLI::line( $command ); 214 ! $dry_run && WP_CLI::runcommand( $command ); 222 $command_args = [ 223 'i18n', 224 'make-pot', 225 $this->source, 226 $this->destination . '/wordpress-admin-network.pot', 227 ]; 228 229 $command_assoc_args = [ 230 'include' => implode( ',', $admin_network_files ), 231 'subtract' => sprintf( '%1$s/wordpress.pot,%1$s/wordpress-admin.pot', $this->destination ), 232 'package-name' => self::PACKAGE_NAME, 233 'headers' => $headers, 234 'file-comment' => $file_comment, 235 'skip-js' => true, // TODO: No use of wp.i18n, yet. 236 'skip-audit' => true, 237 'ignore-domain' => true, 238 ]; 239 240 WP_CLI::run_command( $command_args, $command_assoc_args ); 215 241 } 216 242
Note: See TracChangeset
for help on using the changeset viewer.