2019-03-25 06:43:26 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Updates PHP versions to match those in package.json before start or build.
|
|
|
|
*
|
|
|
|
* @package WooCommerce Admin
|
|
|
|
*/
|
|
|
|
|
|
|
|
$package_json = file_get_contents( 'package.json' );
|
|
|
|
$package = json_decode( $package_json );
|
|
|
|
$plugin_file = file( 'woocommerce-admin.php' );
|
|
|
|
$lines = array();
|
|
|
|
|
|
|
|
foreach ( $plugin_file as $line ) {
|
|
|
|
if ( stripos( $line, ' * Version: ' ) !== false ) {
|
|
|
|
$line = " * Version: {$package->version}\n";
|
|
|
|
}
|
2019-06-14 16:29:03 +00:00
|
|
|
if ( stripos( $line, ">define( 'WC_ADMIN_VERSION_NUMBER'," ) !== false ) {
|
|
|
|
$line = "\t\t\$this->define( 'WC_ADMIN_VERSION_NUMBER', '{$package->version}' );\n";
|
2019-03-25 06:43:26 +00:00
|
|
|
}
|
|
|
|
$lines[] = $line;
|
|
|
|
}
|
|
|
|
file_put_contents( 'woocommerce-admin.php', $lines );
|