-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdevelopment.php
113 lines (90 loc) · 2.15 KB
/
development.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Development environment config
*
* @author NYC Opportunity
*/
/**
* Whoops PHP Error Handler
*
* @link https://github.com/filp/whoops
*
* @author NYC Opportunity
*/
if (class_exists('Whoops\Run')) {
$whoops = new Whoops\Run;
$whoops->pushHandler(new Whoops\Handler\PrettyPageHandler);
$whoops->register();
}
/**
* Shorthand for debug logging. Supports native debug log and query monitor
* logging.
*
* @param String $str The string to log.
* @param Boolean $return Wether to make it human readable.
*
* @author NYC Opportunity
*/
// phpcs:disable
function debug($str, $return = true) {
$backtrace = debug_backtrace()[0];
$file = isset($backtrace['file']) ? $backtrace['file'] . ':' : '';
$line = isset($backtrace['line']) ? $backtrace['line'] : '';
// Sent log to native debug.log
error_log(var_export($str, $return) . " " . $file . $line);
// Send log to Query Monitor
do_action('qm/debug', var_export($str, $return));
}
// phpcs:enable
/**
* Include the plugins module
*
* @author NYC Opportunity
*/
require_once ABSPATH . 'wp-admin/includes/plugin.php';
/**
* Example: Deactivate Plugins
*
* @author NYC Opportunity
*/
// deactivate_plugins([
// 'plugin/plugin.php',
// ]);
/**
* Example: Activate Plugin
*
* @author NYC Opportunity
*/
// activate_plugin('plugin/plugin.php');
/**
* Example: Update Option
*
* @author NYC Opportunity
*/
// update_option('option_name', 'option_value');
/**
* Enable the Redis Caching Plugin if we have WP_REDIS_HOST defined in
* the wp-config.php. Caching will optimize the speed of the site, especially
* transient caches
*
* @author NYC Opportunity
*/
if (null !== WP_REDIS_HOST) {
activate_plugin('redis-cache/redis-cache.php');
}
/**
* Enable Query Monitor for advanced Wordpress Query debug and other tooling
*
* @author NYC Opportunity
*/
activate_plugin('query-monitor/query-monitor.php');
/**
* Allow local development requests
*
* @author NYC Opportunity
*/
// header('Access-Control-Allow-Origin: *');
// add_filter('allowed_http_origins', function($origins) {
// $origins[] = 'http://localhost:7000';
// return $origins;
// });