Changeset 1991341
- Timestamp:
- 12/11/2018 12:53:35 AM (7 years ago)
- Location:
- wpperformancetester/trunk
- Files:
-
- 4 edited
-
README.md (modified) (1 diff)
-
WPPerformanceTester_Plugin.php (modified) (1 diff)
-
benchmark.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpperformancetester/trunk/README.md
r1284607 r1991341 41 41 42 42 > - It's always best to **BACKUP EVERYTHING** before running **ANY** new plugin or making changes to your WordPress install. 43 44 Changelog 45 ------------- 46 ** 1.1 ** 47 48 Added support for hyperdb and socket connections. 49 50 ** 1.0.1 ** 51 52 Updated interface to make graphs and results more clear. 53 54 ** 1.0 ** 55 56 * Initial release -
wpperformancetester/trunk/WPPerformanceTester_Plugin.php
r1949947 r1991341 29 29 if ($performTest){ 30 30 //do test 31 global $wpdb; 31 32 $arr_cfg = array(); 32 $arr_cfg['db.host'] = DB_HOST; 33 $arr_cfg['db.user'] = DB_USER; 34 $arr_cfg['db.pw'] = DB_PASSWORD; 35 $arr_cfg['db.name'] = DB_NAME; 33 34 // We need special handling for hyperdb 35 if ( is_a( $wpdb, 'hyperdb' ) && ! empty( $wpdb->hyper_servers ) ) { 36 // Grab a `write` server for the `global` dataset and fallback to `read`. 37 // We're not really paying attention to priority or have much in the way of error checking. Use at your own risk :) 38 $db_server = false; 39 if ( ! empty( $wpdb->hyper_servers['global']['write'] ) ) { 40 foreach ( $wpdb->hyper_servers['global']['write'] as $group => $dbs ) { 41 $db_server = current( $dbs ); 42 break; 43 } 44 } elseif ( ! empty( $wpdb->hyper_servers['global']['read'] ) ) { 45 foreach ( $wpdb->hyper_servers['global']['read'] as $group => $dbs ) { 46 $db_server = current( $dbs ); 47 break; 48 } 49 } 50 51 if ( $db_server ) { 52 $arr_cfg['db.host'] = $db_server['host']; 53 $arr_cfg['db.user'] = $db_server['user']; 54 $arr_cfg['db.pw'] = $db_server['password']; 55 $arr_cfg['db.name'] = $db_server['name']; 56 } 57 } else { 58 // Vanilla WordPress install with standard `wpdb` 59 $arr_cfg['db.host'] = DB_HOST; 60 $arr_cfg['db.user'] = DB_USER; 61 $arr_cfg['db.pw'] = DB_PASSWORD; 62 $arr_cfg['db.name'] = DB_NAME; 63 } 64 36 65 $arr_benchmark = test_benchmark($arr_cfg); 37 66 $arr_wordpress = test_wordpress(); -
wpperformancetester/trunk/benchmark.php
r1284607 r1991341 36 36 37 37 $arr_return = array(); 38 $arr_return['version'] = '1. 0';38 $arr_return['version'] = '1.1'; 39 39 $arr_return['sysinfo']['time'] = date("Y-m-d H:i:s"); 40 40 $arr_return['sysinfo']['php_version'] = PHP_VERSION; … … 121 121 $time_start = microtime(true); 122 122 123 //parse out port number if exists 124 $port = 3306;//default 125 if(stripos($arr_cfg['db.host'],':')){ 126 $port = substr($arr_cfg['db.host'], stripos($arr_cfg['db.host'],':')+1); 127 $arr_cfg['db.host'] = substr($arr_cfg['db.host'], 0, stripos($arr_cfg['db.host'],':')); 128 } 129 130 $link = mysqli_connect($arr_cfg['db.host'], $arr_cfg['db.user'], $arr_cfg['db.pw'], $arr_cfg['db.name'], $port); 123 124 //detect socket connection 125 if(stripos($arr_cfg['db.host'], '.sock')!==false){ 126 //parse socket location 127 //set a default guess 128 $socket = "/var/lib/mysql.sock"; 129 $serverhost = explode(':', $arr_cfg['db.host']); 130 if(count($serverhost) == 2 && $serverhost[0] == 'localhost'){ 131 $socket = $serverhost[1]; 132 } 133 $link = mysqli_connect('localhost', $arr_cfg['db.user'], $arr_cfg['db.pw'], $arr_cfg['db.name'], null, $socket); 134 }else{ 135 //parse out port number if exists 136 $port = 3306;//default 137 if(stripos($arr_cfg['db.host'],':')){ 138 $port = substr($arr_cfg['db.host'], stripos($arr_cfg['db.host'],':')+1); 139 $arr_cfg['db.host'] = substr($arr_cfg['db.host'], 0, stripos($arr_cfg['db.host'],':')); 140 } 141 $link = mysqli_connect($arr_cfg['db.host'], $arr_cfg['db.user'], $arr_cfg['db.pw'], $arr_cfg['db.name'], $port); 142 } 131 143 $arr_return['benchmark']['mysql_connect'] = timer_diff($time_start); 132 144 -
wpperformancetester/trunk/readme.txt
r1949947 r1991341 3 3 Tags: performance, admin, benchmark 4 4 Requires at least: 3.5 5 Tested up to: 4.9.86 Stable tag: 1. 0.15 Tested up to: 5.0 6 Stable tag: 1.1 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html 9 9 10 WPPerformanceTester benchmarks your server \'s performance through a variety of PHP, MySql and WordPress tests10 WPPerformanceTester benchmarks your server's performance through a variety of PHP, MySql and WordPress tests 11 11 12 12 == Description == 13 WPPerformanceTester was written as a tool to benchmark WordPress in the [WordPress Hosting Performance Benchmarks (2015)](http://reviewsignal.com/blog/2015/07/28/wordpress-hosting-performance-benchmarks-2015/) by [Review Signal](http://reviewsignal.com). It was designed to test the server \'s performance by stressing PHP, MySql and running $wpdb queries.13 WPPerformanceTester was written as a tool to benchmark WordPress in the [WordPress Hosting Performance Benchmarks (2015)](http://reviewsignal.com/blog/2015/07/28/wordpress-hosting-performance-benchmarks-2015/) by [Review Signal](http://reviewsignal.com). It was designed to test the server's performance by stressing PHP, MySql and running $wpdb queries. 14 14 15 15 WPPerformanceTester performs the following tests … … 22 22 - \\$wpdb - 250 insert, select, update and delete operations through \\$wpdb 23 23 24 It also allows you to see how your server \'s performance stacks up against our industry benchmark. Our industry benchmark is the average of all submitted test results.24 It also allows you to see how your server's performance stacks up against our industry benchmark. Our industry benchmark is the average of all submitted test results. 25 25 26 26 == Installation == … … 30 30 31 31 == Changelog == 32 = 1.1 = 33 34 Added support for hyperdb and socket connections. 35 32 36 = 1.0.1 = 33 37
Note: See TracChangeset
for help on using the changeset viewer.