#!/usr/local/bin/php $plugin_version, 'updated_at' => date('Y-m-d H:i:s'), 'description' => 'Fixes', ]; $release_info_file = "{$release_path}/{$__config['info_filename']}"; if ( ! ( $fh = fopen( $release_info_file, 'w' ) ) ) { echo "Can't open file '{$release_info_file}'", PHP_EOL; exit; } if ( ! fwrite( $fh, json_encode( $info, JSON_FORCE_OBJECT | JSON_PRETTY_PRINT ) ) ) { echo "Can't write relese info to file '{$release_info_file}'", PHP_EOL; exit; } fclose( $fh ); // apache auth if ( ! is_file( $release_htaccess) || ! is_file( $release_htpasswd ) ) { // create .htaccess if ( ! ( $fh = fopen( $release_htaccess, 'w' ) ) ) { echo "Can't open file '{$release_htaccess}'", PHP_EOL; exit; } $htaccess_str = /** @lang text */ " AuthUserFile {$release_htpasswd} AuthGroupFile /dev/null AuthName \"login\" AuthType Basic Require User {$__config['auth_username']} "; if ( ! fwrite( $fh, $htaccess_str ) ) { echo "Can't write to file '{$release_htaccess}'", PHP_EOL; exit; } fclose( $fh ); // create .htpasswd if ( ! ( $fh = fopen( $release_htpasswd, 'w' ) ) ) { echo "Can't open file '{$release_htpasswd}'", PHP_EOL; exit; } $password_encrypted = @crypt( $__config['auth_password'] ); $htpasswd_str = "{$__config['auth_username']}:{$password_encrypted}"; if ( ! fwrite( $fh, $htpasswd_str ) ) { echo "Can't write to file '{$release_htpasswd}'", PHP_EOL; exit; } fclose( $fh ); } function get_plugin_version() { global $plugin_path, $plugin_name; $plugin_file = "{$plugin_path}/{$plugin_name}.php"; if ( ! is_file( $plugin_file ) ) { $plugin_file = "{$plugin_path}/index.php"; } if ( ! is_file( $plugin_file ) ) { echo "Can't find plugin file!", PHP_EOL; exit; } $fh = fopen( $plugin_file, 'r' ); while ( ( $line = fgets( $fh ) ) ) { $matches = []; if ( preg_match( '/^[\s\*]*version\s*:\s*(.+)$/i', $line, $matches ) ) { fclose( $fh ); return trim( $matches[1] ); } } return false; }