Version Description
- Small QoL improvements
Download this release
Release Info
Developer | a2hosting |
Plugin | A2 Optimized WP |
Version | 3.0.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.2.1 to 3.0.2.2
- a2-optimized.php +1 -1
- app/class-activator.php +2 -1
- app/class-deactivator.php +5 -7
- app/class-uninstaller.php +0 -4
- app/controllers/admin/class-admin-settings.php +2 -1
- app/models/admin/class-admin-settings.php +28 -13
- app/templates/admin/page-settings/page-settings.php +9 -5
- app/views/admin/class-admin-settings.php +1 -0
- assets/js/admin/a2-optimized.js +4 -4
- core/A2_Optimized_Benchmark.php +29 -21
- core/A2_Optimized_CacheDisk.php +6 -7
- core/A2_Optimized_SiteHealth.php +11 -8
- readme.txt +4 -1
a2-optimized.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @wordpress-plugin
|
10 |
* Plugin Name: A2 Optimized WP
|
11 |
* Plugin URI: https://wordpress.org/plugins/a2-optimized/
|
12 |
-
* Version: 3.0.2.
|
13 |
* Author: A2 Hosting
|
14 |
* Author URI: https://www.a2hosting.com/
|
15 |
* Description: A2 Optimized - WordPress Optimization Plugin
|
9 |
* @wordpress-plugin
|
10 |
* Plugin Name: A2 Optimized WP
|
11 |
* Plugin URI: https://wordpress.org/plugins/a2-optimized/
|
12 |
+
* Version: 3.0.2.2
|
13 |
* Author: A2 Hosting
|
14 |
* Author URI: https://www.a2hosting.com/
|
15 |
* Description: A2 Optimized - WordPress Optimization Plugin
|
app/class-activator.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
namespace A2_Optimized\App;
|
3 |
|
|
|
|
|
4 |
/**
|
5 |
* Fired during plugin activation.
|
6 |
*
|
@@ -9,7 +11,6 @@ namespace A2_Optimized\App;
|
|
9 |
* @since 3.0.0
|
10 |
* @package A2_Optimized
|
11 |
* @subpackage A2_Optimized/App
|
12 |
-
* @author Your Name <email@example.com>
|
13 |
*/
|
14 |
class Activator {
|
15 |
|
1 |
<?php
|
2 |
namespace A2_Optimized\App;
|
3 |
|
4 |
+
|
5 |
+
|
6 |
/**
|
7 |
* Fired during plugin activation.
|
8 |
*
|
11 |
* @since 3.0.0
|
12 |
* @package A2_Optimized
|
13 |
* @subpackage A2_Optimized/App
|
|
|
14 |
*/
|
15 |
class Activator {
|
16 |
|
app/class-deactivator.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
namespace A2_Optimized\App;
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Fired during plugin deactivation.
|
@@ -9,14 +11,9 @@ namespace A2_Optimized\App;
|
|
9 |
* @since 3.0.0
|
10 |
* @package A2_Optimized
|
11 |
* @subpackage A2_Optimized/App
|
12 |
-
* @author Your Name <email@example.com>
|
13 |
*/
|
14 |
class Deactivator {
|
15 |
/**
|
16 |
-
* Short Description. (use period)
|
17 |
-
*
|
18 |
-
* Long Description.
|
19 |
-
*
|
20 |
* @since 3.0.0
|
21 |
*/
|
22 |
public function deactivate() {
|
@@ -33,11 +30,12 @@ class Deactivator {
|
|
33 |
fwrite($fp, $htaccess);
|
34 |
fflush($fp); // flush output before releasing the lock
|
35 |
flock($fp, LOCK_UN); // release the lock
|
36 |
-
} else {
|
37 |
-
//no file lock :(
|
38 |
}
|
39 |
|
40 |
// deactivate the scheduled weekly database optimizations
|
41 |
wp_clear_scheduled_hook('a2_execute_db_optimizations');
|
|
|
|
|
|
|
42 |
}
|
43 |
}
|
1 |
<?php
|
2 |
namespace A2_Optimized\App;
|
3 |
+
require_once plugin_dir_path( __FILE__ ) . '../core/A2_Optimized_Cache.php';
|
4 |
+
require_once plugin_dir_path( __FILE__ ) . '../core/A2_Optimized_CacheDisk.php';
|
5 |
|
6 |
/**
|
7 |
* Fired during plugin deactivation.
|
11 |
* @since 3.0.0
|
12 |
* @package A2_Optimized
|
13 |
* @subpackage A2_Optimized/App
|
|
|
14 |
*/
|
15 |
class Deactivator {
|
16 |
/**
|
|
|
|
|
|
|
|
|
17 |
* @since 3.0.0
|
18 |
*/
|
19 |
public function deactivate() {
|
30 |
fwrite($fp, $htaccess);
|
31 |
fflush($fp); // flush output before releasing the lock
|
32 |
flock($fp, LOCK_UN); // release the lock
|
|
|
|
|
33 |
}
|
34 |
|
35 |
// deactivate the scheduled weekly database optimizations
|
36 |
wp_clear_scheduled_hook('a2_execute_db_optimizations');
|
37 |
+
|
38 |
+
// clean disk cache files
|
39 |
+
\A2_Optimized_Cache::on_deactivation(is_multisite() && is_network_admin());
|
40 |
}
|
41 |
}
|
app/class-uninstaller.php
CHANGED
@@ -9,14 +9,10 @@ namespace A2_Optimized\App;
|
|
9 |
* @since 3.0.0
|
10 |
* @package A2_Optimized
|
11 |
* @subpackage A2_Optimized/App
|
12 |
-
* @author Your Name <email@example.com>
|
13 |
*/
|
14 |
class Uninstaller {
|
15 |
|
16 |
/**
|
17 |
-
* Short Description. (use period)
|
18 |
-
*
|
19 |
-
* Long Description.
|
20 |
*
|
21 |
* @since 3.0.0
|
22 |
*/
|
9 |
* @since 3.0.0
|
10 |
* @package A2_Optimized
|
11 |
* @subpackage A2_Optimized/App
|
|
|
12 |
*/
|
13 |
class Uninstaller {
|
14 |
|
15 |
/**
|
|
|
|
|
|
|
16 |
*
|
17 |
* @since 3.0.0
|
18 |
*/
|
app/controllers/admin/class-admin-settings.php
CHANGED
@@ -263,7 +263,8 @@ if (! class_exists(__NAMESPACE__ . '\\' . 'Admin_Settings')) {
|
|
263 |
'settings_name' => $this->get_model()->get_plugin_settings_option_key(),
|
264 |
'notifications' => $notifications,
|
265 |
'graphs' => $graphs['pagespeed_desktop'],
|
266 |
-
'run_benchmarks' => $run_benchmarks
|
|
|
267 |
]
|
268 |
);
|
269 |
|
263 |
'settings_name' => $this->get_model()->get_plugin_settings_option_key(),
|
264 |
'notifications' => $notifications,
|
265 |
'graphs' => $graphs['pagespeed_desktop'],
|
266 |
+
'run_benchmarks' => $run_benchmarks,
|
267 |
+
'status_message' => $graphs['status_message'],
|
268 |
]
|
269 |
);
|
270 |
|
app/models/admin/class-admin-settings.php
CHANGED
@@ -82,7 +82,6 @@ if ( ! class_exists( __NAMESPACE__ . '\\' . 'Admin_Settings' ) ) {
|
|
82 |
break;
|
83 |
}
|
84 |
|
85 |
-
|
86 |
echo json_encode($data);
|
87 |
wp_die();
|
88 |
}
|
@@ -190,6 +189,8 @@ if ( ! class_exists( __NAMESPACE__ . '\\' . 'Admin_Settings' ) ) {
|
|
190 |
'filesystem' => $benchmark['filesystem']
|
191 |
];
|
192 |
$entry = array_merge(self::BENCHMARK_DISPLAY_DATA[$key], $entry);
|
|
|
|
|
193 |
$result['graph_data'][$key] = $entry;
|
194 |
}
|
195 |
$result['graphs']['webperformance'] = self::BENCHMARK_DISPLAY_DATA['webperformance'];
|
@@ -200,12 +201,18 @@ if ( ! class_exists( __NAMESPACE__ . '\\' . 'Admin_Settings' ) ) {
|
|
200 |
}
|
201 |
|
202 |
public function get_frontend_benchmark($run = false) {
|
|
|
203 |
if ($run) {
|
204 |
$desktop_result = $this->benchmark->get_lighthouse_results('desktop');
|
205 |
$mobile_result = $this->benchmark->get_lighthouse_results('mobile');
|
206 |
|
207 |
if ($desktop_result['status'] != 'success' || $mobile_result['status'] != 'success') {
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
209 |
}
|
210 |
}
|
211 |
|
@@ -274,6 +281,7 @@ if ( ! class_exists( __NAMESPACE__ . '\\' . 'Admin_Settings' ) ) {
|
|
274 |
$result['pagespeed_mobile'] = $this->get_graph_data('None', $mobile, null);
|
275 |
}
|
276 |
|
|
|
277 |
return $result;
|
278 |
}
|
279 |
|
@@ -407,36 +415,43 @@ if ( ! class_exists( __NAMESPACE__ . '\\' . 'Admin_Settings' ) ) {
|
|
407 |
'benchmark-host' => [
|
408 |
'display_text' => 'Your Host',
|
409 |
'metric_text' => '',
|
410 |
-
'explanation' => '
|
411 |
'color_class' => 'thishost'
|
412 |
],
|
413 |
'a2hosting-turbo' => [
|
414 |
'display_text' => 'Turbo Boost',
|
415 |
'metric_text' => '',
|
416 |
-
'explanation' => '
|
417 |
'color_class' => 'warn'
|
418 |
],
|
419 |
-
'a2hosting-
|
420 |
'display_text' => 'Managed Wordpress',
|
421 |
'metric_text' => '',
|
422 |
-
'explanation' => '
|
423 |
'color_class' => 'success'
|
424 |
],
|
425 |
'webperformance' => [
|
426 |
'display_text' => 'Web Performance',
|
427 |
-
'metric_text' =>
|
428 |
'legend_text' => "Overall Wordpress Execution Time",
|
429 |
-
'explanation' => 'The web performance score measures how your current host performs compared to A2 Hosting. This web performance score looks at server speed and other metrics to determine how fast your website will load, based on which hosting company & plan you host your website with. <br />
|
430 |
-
|
431 |
-
|
|
|
|
|
|
|
432 |
'color_class' => 'success'
|
433 |
],
|
434 |
'serverperformance' => [
|
435 |
'display_text' => 'Server Performance',
|
436 |
-
'metric_text' => "How fast is your hosting
|
437 |
'legend_text' => "PHP, Mysql, and File I/O Response Time Comparison",
|
438 |
-
'explanation' => 'The lower the scores on the graph, the faster your experience will be in the WordPress Admin dashboard and on pages that use dynamic content that can\'t be easily cached—like search forms and shopping carts. <br />
|
439 |
-
Not all hosting companies and plans use the same hardware. If your current host has a lower server performance score than A2 Hosting, then consider moving your websites to A2 Hosting. A2 Hosting uses the best server hardware on the market, focusing on speed & security. A2 Hosting also offers free site migration to help you move your existing websites to them
|
|
|
|
|
|
|
|
|
440 |
'color_class' => 'success'
|
441 |
],
|
442 |
'optimizations' => [
|
82 |
break;
|
83 |
}
|
84 |
|
|
|
85 |
echo json_encode($data);
|
86 |
wp_die();
|
87 |
}
|
189 |
'filesystem' => $benchmark['filesystem']
|
190 |
];
|
191 |
$entry = array_merge(self::BENCHMARK_DISPLAY_DATA[$key], $entry);
|
192 |
+
$entry['display_text'] = $benchmark['name'];
|
193 |
+
$entry['explanation'] = $benchmark['explanation'];
|
194 |
$result['graph_data'][$key] = $entry;
|
195 |
}
|
196 |
$result['graphs']['webperformance'] = self::BENCHMARK_DISPLAY_DATA['webperformance'];
|
201 |
}
|
202 |
|
203 |
public function get_frontend_benchmark($run = false) {
|
204 |
+
$status_message = "";
|
205 |
if ($run) {
|
206 |
$desktop_result = $this->benchmark->get_lighthouse_results('desktop');
|
207 |
$mobile_result = $this->benchmark->get_lighthouse_results('mobile');
|
208 |
|
209 |
if ($desktop_result['status'] != 'success' || $mobile_result['status'] != 'success') {
|
210 |
+
if(isset($desktop_result['message'])){
|
211 |
+
$status_message = $desktop_result['message'];
|
212 |
+
}
|
213 |
+
if(isset($mobile_result['message'])){
|
214 |
+
$status_message = $mobile_result['message'];
|
215 |
+
}
|
216 |
}
|
217 |
}
|
218 |
|
281 |
$result['pagespeed_mobile'] = $this->get_graph_data('None', $mobile, null);
|
282 |
}
|
283 |
|
284 |
+
$result['status_message'] = $status_message;
|
285 |
return $result;
|
286 |
}
|
287 |
|
415 |
'benchmark-host' => [
|
416 |
'display_text' => 'Your Host',
|
417 |
'metric_text' => '',
|
418 |
+
'explanation' => 'Your Host',
|
419 |
'color_class' => 'thishost'
|
420 |
],
|
421 |
'a2hosting-turbo' => [
|
422 |
'display_text' => 'Turbo Boost',
|
423 |
'metric_text' => '',
|
424 |
+
'explanation' => '',
|
425 |
'color_class' => 'warn'
|
426 |
],
|
427 |
+
'a2hosting-other' => [
|
428 |
'display_text' => 'Managed Wordpress',
|
429 |
'metric_text' => '',
|
430 |
+
'explanation' => '',
|
431 |
'color_class' => 'success'
|
432 |
],
|
433 |
'webperformance' => [
|
434 |
'display_text' => 'Web Performance',
|
435 |
+
'metric_text' => "How does your hosting <strong>compare</strong> to A2 Hosting's best plans? With the graphs below <strong>LOWER IS BETTER</strong>.",
|
436 |
'legend_text' => "Overall Wordpress Execution Time",
|
437 |
+
'explanation' => 'The web performance score measures how your current host performs compared to A2 Hosting. This web performance score looks at server speed and other metrics to determine how fast your website will load, based on which hosting company & plan you host your website with. <br /><br />
|
438 |
+
The lower the score on the graph the faster your website will load. Not all hosting companies and plans use the same hardware. A2 Hosting uses the best server hardware on the market, focusing on speed & security. A2 Hosting also offers free site migration to help you move your existing websites to them.<br /><br />
|
439 |
+
Graphs are representitive of the following, and individual results may vary based on current server load, PHP version, WordPress version, etc.<br />
|
440 |
+
<li><strong>Fastest Shared</strong> is our Turbo Max 2022 Shared plan on our current fastest server.</li>
|
441 |
+
<li><strong>Premium Managed</strong> is our Fly Managed WordPress plan on our current fastest server.</li>
|
442 |
+
<li><strong>Avg. of all Plans</strong> is an calculated average of WordPress sites across all A2 Hosting plans and servers.</li>',
|
443 |
'color_class' => 'success'
|
444 |
],
|
445 |
'serverperformance' => [
|
446 |
'display_text' => 'Server Performance',
|
447 |
+
'metric_text' => "How fast is your hosting <strong>compared</strong> to A2 Hosting's best plans? With the graphs below <strong>LOWER IS BETTER</strong>.",
|
448 |
'legend_text' => "PHP, Mysql, and File I/O Response Time Comparison",
|
449 |
+
'explanation' => 'The lower the scores on the graph, the faster your experience will be in the WordPress Admin dashboard and on pages that use dynamic content that can\'t be easily cached—like search forms and shopping carts. <br /><br />
|
450 |
+
Not all hosting companies and plans use the same hardware. If your current host has a lower server performance score than A2 Hosting, then consider moving your websites to A2 Hosting. A2 Hosting uses the best server hardware on the market, focusing on speed & security. A2 Hosting also offers free site migration to help you move your existing websites to them.<br /><br />
|
451 |
+
Graphs are representitive of the following, and individual results may vary based on current server load, PHP version, WordPress version, etc.<br />
|
452 |
+
<li><strong>Fastest Shared</strong> is our Turbo Max 2022 Shared plan on our current fastest server.</li>
|
453 |
+
<li><strong>Premium Managed</strong> is our Fly Managed WordPress plan on our current fastest server.</li>
|
454 |
+
<li><strong>Avg. of all Plans</strong> is an calculated average of WordPress sites across all A2 Hosting plans and servers.</li>',
|
455 |
'color_class' => 'success'
|
456 |
],
|
457 |
'optimizations' => [
|
app/templates/admin/page-settings/page-settings.php
CHANGED
@@ -185,7 +185,7 @@
|
|
185 |
<div class="row">
|
186 |
<div class="col-sm-11 col-sm-offset-1">
|
187 |
<h4>{{graphs.webperformance.display_text}}</h4>
|
188 |
-
<p
|
189 |
</div>
|
190 |
</div>
|
191 |
<div class="row" style="max-height:500px;">
|
@@ -201,7 +201,6 @@
|
|
201 |
<div class="row">
|
202 |
<div class="col-sm-11 col-sm-offset-1">
|
203 |
<h4>{{graphs.webperformance.display_text}}</h4>
|
204 |
-
<p>{{graphs.webperformance.metric_text}}</p>
|
205 |
</div>
|
206 |
</div>
|
207 |
<div class="row">
|
@@ -220,7 +219,7 @@
|
|
220 |
<div class="row">
|
221 |
<div class="col-sm-11 col-sm-offset-1">
|
222 |
<h4>{{graphs.serverperformance.display_text}}</h4>
|
223 |
-
<p
|
224 |
</div>
|
225 |
</div>
|
226 |
<div class="row" style="max-height:500px">
|
@@ -236,7 +235,6 @@
|
|
236 |
<div class="row">
|
237 |
<div class="col-sm-11 col-sm-offset-1">
|
238 |
<h4>{{graphs.serverperformance.display_text}}</h4>
|
239 |
-
<p>{{graphs.serverperformance.metric_text}}</p>
|
240 |
</div>
|
241 |
</div>
|
242 |
<div class="row">
|
@@ -522,6 +520,9 @@
|
|
522 |
<div v-if="show_coaching" class="notice notice-warning">
|
523 |
<p>Click Run Check to see how fast your page loads. The higher the score the better!</p>
|
524 |
</div>
|
|
|
|
|
|
|
525 |
</div>
|
526 |
<div class="col-sm-11 col-sm-offset-1">
|
527 |
<div v-if="graphs.pagespeed_mobile" class="col-sm-5 box-element" :class="graphs.pagespeed_mobile.overall_score.color_class">
|
@@ -648,6 +649,9 @@
|
|
648 |
<div class="notice notice-warning"><p>Click Run Check to see how fast your page loads.</p></div>
|
649 |
</div>
|
650 |
</div>
|
|
|
|
|
|
|
651 |
<div class="row padding-bottom"></div>
|
652 |
<div class="row">
|
653 |
<div class="col-sm-4"> <!-- using graphs.ttfb -->
|
@@ -663,7 +667,7 @@
|
|
663 |
<div class="row">
|
664 |
<div class="col-sm-12">
|
665 |
<h4>{{graphs.overall_score.display_text}}</h4>
|
666 |
-
<p
|
667 |
</div>
|
668 |
</div>
|
669 |
<div class="row">
|
185 |
<div class="row">
|
186 |
<div class="col-sm-11 col-sm-offset-1">
|
187 |
<h4>{{graphs.webperformance.display_text}}</h4>
|
188 |
+
<p><span v-html="graphs.webperformance.metric_text"></span></p>
|
189 |
</div>
|
190 |
</div>
|
191 |
<div class="row" style="max-height:500px;">
|
201 |
<div class="row">
|
202 |
<div class="col-sm-11 col-sm-offset-1">
|
203 |
<h4>{{graphs.webperformance.display_text}}</h4>
|
|
|
204 |
</div>
|
205 |
</div>
|
206 |
<div class="row">
|
219 |
<div class="row">
|
220 |
<div class="col-sm-11 col-sm-offset-1">
|
221 |
<h4>{{graphs.serverperformance.display_text}}</h4>
|
222 |
+
<p><span v-html="graphs.serverperformance.metric_text"></span></p>
|
223 |
</div>
|
224 |
</div>
|
225 |
<div class="row" style="max-height:500px">
|
235 |
<div class="row">
|
236 |
<div class="col-sm-11 col-sm-offset-1">
|
237 |
<h4>{{graphs.serverperformance.display_text}}</h4>
|
|
|
238 |
</div>
|
239 |
</div>
|
240 |
<div class="row">
|
520 |
<div v-if="show_coaching" class="notice notice-warning">
|
521 |
<p>Click Run Check to see how fast your page loads. The higher the score the better!</p>
|
522 |
</div>
|
523 |
+
<div v-if="graphs.status_message" class="notice notice-warning">
|
524 |
+
<p v-html="graphs.status_message"></p>
|
525 |
+
</div>
|
526 |
</div>
|
527 |
<div class="col-sm-11 col-sm-offset-1">
|
528 |
<div v-if="graphs.pagespeed_mobile" class="col-sm-5 box-element" :class="graphs.pagespeed_mobile.overall_score.color_class">
|
649 |
<div class="notice notice-warning"><p>Click Run Check to see how fast your page loads.</p></div>
|
650 |
</div>
|
651 |
</div>
|
652 |
+
<div v-if="status_message" class="notice notice-warning">
|
653 |
+
<p v-html="status_message"></p>
|
654 |
+
</div>
|
655 |
<div class="row padding-bottom"></div>
|
656 |
<div class="row">
|
657 |
<div class="col-sm-4"> <!-- using graphs.ttfb -->
|
667 |
<div class="row">
|
668 |
<div class="col-sm-12">
|
669 |
<h4>{{graphs.overall_score.display_text}}</h4>
|
670 |
+
<p><span v-html="graphs.overall_score.metric_text"></span></p>
|
671 |
</div>
|
672 |
</div>
|
673 |
<div class="row">
|
app/views/admin/class-admin-settings.php
CHANGED
@@ -98,6 +98,7 @@ if (! class_exists(__NAMESPACE__ . '\\' . 'Admin_Settings')) {
|
|
98 |
],
|
99 |
'last_check_date' => $pagespeed_last_check,
|
100 |
'graphs' => $graphs,
|
|
|
101 |
];
|
102 |
$data_json = json_encode($data);
|
103 |
|
98 |
],
|
99 |
'last_check_date' => $pagespeed_last_check,
|
100 |
'graphs' => $graphs,
|
101 |
+
'status_message' => $args['status_message'],
|
102 |
];
|
103 |
$data_json = json_encode($data);
|
104 |
|
assets/js/admin/a2-optimized.js
CHANGED
@@ -52,7 +52,7 @@ const plugin_draw_a2hosting_box = {
|
|
52 |
}
|
53 |
|
54 |
function generateSingleBarGraphData(graph, dataPoint) {
|
55 |
-
graph_products = ['host', 'a2hosting-turbo', 'a2hosting-
|
56 |
|
57 |
let set_title = graph.legend_text;
|
58 |
|
@@ -65,7 +65,7 @@ function generateSingleBarGraphData(graph, dataPoint) {
|
|
65 |
|
66 |
graph_products.forEach((product, index, array) => {
|
67 |
let data_entry = page_data.graph_data[product];
|
68 |
-
graph_labels[index] = data_entry.
|
69 |
|
70 |
|
71 |
let value = parseFloat(data_entry[dataPoint]);
|
@@ -87,7 +87,7 @@ function generateSingleBarGraphData(graph, dataPoint) {
|
|
87 |
}
|
88 |
|
89 |
function generateStackedBarGraphData(graph, dataPoints = []) {
|
90 |
-
graph_products = ['host', 'a2hosting-turbo', 'a2hosting-
|
91 |
|
92 |
let set_title = graph.legend_text;
|
93 |
|
@@ -103,7 +103,7 @@ function generateStackedBarGraphData(graph, dataPoints = []) {
|
|
103 |
|
104 |
// pre grab some info by product -> metric
|
105 |
graph_products.forEach((el, prodIndex, array) => {
|
106 |
-
graph_labels[prodIndex] = page_data.graph_data[el].
|
107 |
dataPoints.forEach((dataPointName, metricIndex, array) => {
|
108 |
let data_entry = page_data.graph_data[el];
|
109 |
|
52 |
}
|
53 |
|
54 |
function generateSingleBarGraphData(graph, dataPoint) {
|
55 |
+
graph_products = ['host', 'a2hosting-turbo', 'a2hosting-other'];
|
56 |
|
57 |
let set_title = graph.legend_text;
|
58 |
|
65 |
|
66 |
graph_products.forEach((product, index, array) => {
|
67 |
let data_entry = page_data.graph_data[product];
|
68 |
+
graph_labels[index] = data_entry.explanation;
|
69 |
|
70 |
|
71 |
let value = parseFloat(data_entry[dataPoint]);
|
87 |
}
|
88 |
|
89 |
function generateStackedBarGraphData(graph, dataPoints = []) {
|
90 |
+
graph_products = ['host', 'a2hosting-turbo', 'a2hosting-other'];
|
91 |
|
92 |
let set_title = graph.legend_text;
|
93 |
|
103 |
|
104 |
// pre grab some info by product -> metric
|
105 |
graph_products.forEach((el, prodIndex, array) => {
|
106 |
+
graph_labels[prodIndex] = page_data.graph_data[el].explanation;
|
107 |
dataPoints.forEach((dataPointName, metricIndex, array) => {
|
108 |
let data_entry = page_data.graph_data[el];
|
109 |
|
core/A2_Optimized_Benchmark.php
CHANGED
@@ -621,43 +621,51 @@ class A2_Optimized_Benchmark {
|
|
621 |
$results = [];
|
622 |
|
623 |
$results['a2hosting-turbo'] = [
|
624 |
-
'name' => '
|
|
|
625 |
'php' => [
|
626 |
'benchmark' => [
|
627 |
-
'math' => '0.
|
628 |
-
'string' => '0.
|
629 |
-
'loop' => '0.
|
630 |
-
'ifelse' => '0.
|
631 |
],
|
632 |
-
'total' => '1.
|
633 |
],
|
634 |
-
'mysql' => '1.
|
635 |
'wordpress_db' => [
|
636 |
-
'time' => '1.
|
637 |
-
'queries_per_second' => '
|
638 |
],
|
639 |
-
'filesystem' => '
|
640 |
];
|
641 |
|
642 |
-
$results['a2hosting-
|
643 |
-
'name' => '
|
|
|
644 |
'php' => [
|
645 |
'benchmark' => [
|
646 |
-
'math' => '0.
|
647 |
-
'string' => '0.
|
648 |
-
'loop' => '0.
|
649 |
-
'ifelse' => '0.
|
650 |
],
|
651 |
-
'total' => '0.
|
652 |
],
|
653 |
-
'mysql' => '1.
|
654 |
'wordpress_db' => [
|
655 |
-
'time' => '1.
|
656 |
-
'queries_per_second' => '
|
657 |
],
|
658 |
-
'filesystem' => '2.
|
659 |
];
|
660 |
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
return $results;
|
662 |
}
|
663 |
|
621 |
$results = [];
|
622 |
|
623 |
$results['a2hosting-turbo'] = [
|
624 |
+
'name' => 'Turbo Max',
|
625 |
+
'explanation' => 'Fastest Shared',
|
626 |
'php' => [
|
627 |
'benchmark' => [
|
628 |
+
'math' => '0.074',
|
629 |
+
'string' => '0.201',
|
630 |
+
'loop' => '0.280',
|
631 |
+
'ifelse' => '0.512',
|
632 |
],
|
633 |
+
'total' => '1.068',
|
634 |
],
|
635 |
+
'mysql' => '1.907',
|
636 |
'wordpress_db' => [
|
637 |
+
'time' => '1.606',
|
638 |
+
'queries_per_second' => '1245.33',
|
639 |
],
|
640 |
+
'filesystem' => '2.503',
|
641 |
];
|
642 |
|
643 |
+
$results['a2hosting-other'] = [
|
644 |
+
'name' => 'Fly',
|
645 |
+
'explanation' => 'Premium Managed',
|
646 |
'php' => [
|
647 |
'benchmark' => [
|
648 |
+
'math' => '0.078',
|
649 |
+
'string' => '0.196',
|
650 |
+
'loop' => '0.268',
|
651 |
+
'ifelse' => '0.393',
|
652 |
],
|
653 |
+
'total' => '0.935',
|
654 |
],
|
655 |
+
'mysql' => '1.863',
|
656 |
'wordpress_db' => [
|
657 |
+
'time' => '1.673',
|
658 |
+
'queries_per_second' => '1195.4',
|
659 |
],
|
660 |
+
'filesystem' => '2.337',
|
661 |
];
|
662 |
|
663 |
+
if(file_exists('/opt/a2-optimized/wordpress/class.A2_Optimized_Private_Optimizations_v3.php')){
|
664 |
+
require_once('/opt/a2-optimized/wordpress/class.A2_Optimized_Private_Optimizations_v3.php');
|
665 |
+
$private_opts = new A2_Optimized_Private_Optimizations();
|
666 |
+
$results['a2hosting-other'] = $private_opts->get_baseline_results();
|
667 |
+
}
|
668 |
+
|
669 |
return $results;
|
670 |
}
|
671 |
|
core/A2_Optimized_CacheDisk.php
CHANGED
@@ -66,18 +66,17 @@ final class A2_Optimized_Cache_Disk {
|
|
66 |
self::delete_settings_file();
|
67 |
|
68 |
// check if settings directory exists
|
69 |
-
if ( !
|
70 |
// delete old advanced cache settings file(s) (1.4.0)
|
71 |
array_map( 'unlink', glob( WP_CONTENT_DIR . '/cache/a2opt-cache-advcache-*.json' ) );
|
72 |
// delete incorrect advanced cache settings file(s) that may have been created in 1.4.0 (1.4.5)
|
73 |
array_map( 'unlink', glob( ABSPATH . 'A2OPT_SETTINGS_PATH-*.json' ) );
|
74 |
-
// delete advanced-cache.php drop-in
|
75 |
-
@unlink( WP_CONTENT_DIR . '/advanced-cache.php' );
|
76 |
-
// delete object-cache.php drop-in
|
77 |
-
@unlink( WP_CONTENT_DIR . '/object-cache.php' );
|
78 |
-
// unset WP_CACHE constant in config file if set
|
79 |
-
self::set_wp_cache_constant( false );
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
/**
|
66 |
self::delete_settings_file();
|
67 |
|
68 |
// check if settings directory exists
|
69 |
+
if ( !is_dir( self::$settings_dir ) ) {
|
70 |
// delete old advanced cache settings file(s) (1.4.0)
|
71 |
array_map( 'unlink', glob( WP_CONTENT_DIR . '/cache/a2opt-cache-advcache-*.json' ) );
|
72 |
// delete incorrect advanced cache settings file(s) that may have been created in 1.4.0 (1.4.5)
|
73 |
array_map( 'unlink', glob( ABSPATH . 'A2OPT_SETTINGS_PATH-*.json' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
+
// delete advanced-cache.php drop-in
|
76 |
+
@unlink( WP_CONTENT_DIR . '/advanced-cache.php' );
|
77 |
+
// unset WP_CACHE constant in config file if set
|
78 |
+
self::set_wp_cache_constant( false );
|
79 |
+
//wp_die();
|
80 |
}
|
81 |
|
82 |
/**
|
core/A2_Optimized_SiteHealth.php
CHANGED
@@ -336,7 +336,7 @@ class A2_Optimized_SiteHealth {
|
|
336 |
*/
|
337 |
public function a2opt_phpopcache_test() {
|
338 |
$result = array(
|
339 |
-
'label' => __( '
|
340 |
'status' => 'good', // Default "passing" section
|
341 |
'badge' => array(
|
342 |
'label' => __( 'Performance' ),
|
@@ -347,7 +347,7 @@ class A2_Optimized_SiteHealth {
|
|
347 |
__( 'Your site is cached and fast!' )
|
348 |
),
|
349 |
'actions' => '',
|
350 |
-
'test' => '
|
351 |
);
|
352 |
|
353 |
if(function_exists('opcache_get_status')){
|
@@ -575,22 +575,25 @@ class A2_Optimized_SiteHealth {
|
|
575 |
*/
|
576 |
public function a2opt_gzip_test() {
|
577 |
$result = array(
|
578 |
-
'label' => __( '
|
579 |
-
'status' => '
|
580 |
'badge' => array(
|
581 |
'label' => __( 'Performance' ),
|
582 |
'color' => 'orange',
|
583 |
),
|
584 |
'description' => sprintf(
|
585 |
'<p>%s</p>',
|
586 |
-
__( '
|
587 |
),
|
588 |
'actions' => '',
|
589 |
-
'test' => '
|
590 |
);
|
591 |
|
592 |
-
if
|
593 |
-
$result['status'] = '
|
|
|
|
|
|
|
594 |
}
|
595 |
|
596 |
return $result;
|
336 |
*/
|
337 |
public function a2opt_phpopcache_test() {
|
338 |
$result = array(
|
339 |
+
'label' => __( 'PHP OpCaching is enabled' ),
|
340 |
'status' => 'good', // Default "passing" section
|
341 |
'badge' => array(
|
342 |
'label' => __( 'Performance' ),
|
347 |
__( 'Your site is cached and fast!' )
|
348 |
),
|
349 |
'actions' => '',
|
350 |
+
'test' => 'opcaching_enabled',
|
351 |
);
|
352 |
|
353 |
if(function_exists('opcache_get_status')){
|
575 |
*/
|
576 |
public function a2opt_gzip_test() {
|
577 |
$result = array(
|
578 |
+
'label' => __( 'You should enable GZIP compression' ),
|
579 |
+
'status' => 'recommended', // Default "failing" section
|
580 |
'badge' => array(
|
581 |
'label' => __( 'Performance' ),
|
582 |
'color' => 'orange',
|
583 |
),
|
584 |
'description' => sprintf(
|
585 |
'<p>%s</p>',
|
586 |
+
__( 'Compresses all text files to make them smaller.' )
|
587 |
),
|
588 |
'actions' => '',
|
589 |
+
'test' => 'gzip_compression',
|
590 |
);
|
591 |
|
592 |
+
if(is_plugin_active('litespeed-cache/litespeed-cache.php')){
|
593 |
+
$result['status'] = 'good';
|
594 |
+
}
|
595 |
+
else if(get_option('a2_cache_enabled') == 1 && A2_Optimized_Cache_Engine::$settings['compress_cache']) {
|
596 |
+
$result['status'] = 'good';
|
597 |
}
|
598 |
|
599 |
return $result;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: a2hosting, supersoju
|
|
3 |
Tags: a2 hosting, cache, caching, speed, fast, optimize, site performance, image optimization, image compression, site security, seo, gzip compression, minify code, code minification
|
4 |
Requires at least: 5.1
|
5 |
Tested up to: 6.1
|
6 |
-
Stable tag: 3.0.2.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -150,6 +150,9 @@ Yes. A2 Optimized works on any host that supports WordPress; however, A2 Hostin
|
|
150 |
|
151 |
== Changelog ==
|
152 |
|
|
|
|
|
|
|
153 |
= 3.0.2 =
|
154 |
* Fixes issues with some optimizations not displaying status properly
|
155 |
|
3 |
Tags: a2 hosting, cache, caching, speed, fast, optimize, site performance, image optimization, image compression, site security, seo, gzip compression, minify code, code minification
|
4 |
Requires at least: 5.1
|
5 |
Tested up to: 6.1
|
6 |
+
Stable tag: 3.0.2.2
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
150 |
|
151 |
== Changelog ==
|
152 |
|
153 |
+
= 3.0.2.2 =
|
154 |
+
* Small QoL improvements
|
155 |
+
|
156 |
= 3.0.2 =
|
157 |
* Fixes issues with some optimizations not displaying status properly
|
158 |
|