Changeset 782629
- Timestamp:
- 10/04/2013 03:53:46 PM (12 years ago)
- Location:
- observer/trunk
- Files:
-
- 3 edited
-
lib/AMWObserver.php (modified) (2 diffs)
-
observer.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
observer/trunk/lib/AMWObserver.php
r769751 r782629 4 4 5 5 protected $logfile; 6 protected $version = '1.0. 1';6 protected $version = '1.0.2'; 7 7 8 8 /** … … 122 122 } 123 123 124 // convert values to strings 125 $oldvalue = (is_array($oldvalue) || is_object($oldvalue)) ? serialize($oldvalue) : $oldvalue; 126 $newvalue = (is_array($newvalue) || is_object($newvalue)) ? serialize($newvalue) : $newvalue; 127 $data = sprintf("(%s)->(%s)", $oldvalue, $newvalue); 124 // handle this option separately? 125 $specialHandler = 'handle_option_' . $option; 126 if (method_exists($this, $specialHandler)) { 127 128 call_user_func(array(&$this, $specialHandler)); 129 130 } else { 131 132 // convert values to strings 133 $oldvalue = (is_array($oldvalue) || is_object($oldvalue)) ? serialize($oldvalue) : $oldvalue; 134 $newvalue = (is_array($newvalue) || is_object($newvalue)) ? serialize($newvalue) : $newvalue; 135 $data = sprintf("(%s)->(%s)", $oldvalue, $newvalue); 136 $blogId = get_current_blog_id(); 137 $this->log('updated_option', $blogId, $option, $data); 138 139 } 140 141 } 142 143 /** 144 * Logs when 'active_plugins' option is updated. 145 * @param string $option The name of the option that was changed. 146 * @param mixed $newvalue The new value for the option. 147 * @param mixed $oldvalue The old value for the option. 148 * @return void 149 */ 150 public function handle_option_active_plugins($option, $oldvalue, $newvalue) { 151 152 // make sure we work with arrays 153 $oldvalue = (is_array($oldvalue)) ? $oldvalue : array(); 154 $newvalue = (is_array($newvalue)) ? $newvalue : array(); 155 156 // get changes 157 $deactivated = array_diff($oldvalue, $newvalue); 158 $activated = array_diff($newvalue, $oldvalue); 159 160 // make a readable representation of the changes 161 $data = ''; 162 if (count($deactivated)) { 163 $data .= '(DEACTIVATED: "' . implode('","', $deactivated) . '")'; 164 } 165 if (count($activated)) { 166 $data .= '(ACTIVATED: "' . implode('","', $activated) . '")'; 167 } 168 169 // log it 128 170 $blogId = get_current_blog_id(); 129 171 $this->log('updated_option', $blogId, $option, $data); 172 130 173 } 131 174 -
observer/trunk/observer.php
r769751 r782629 4 4 Plugin URI: http://amwhalen.com 5 5 Description: Creates an audit trail log file for multisite super admin actions. Used only for multisite installations, and must be Network Activated. 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: Andy Whalen 8 8 Author URI: http://amwhalen.com -
observer/trunk/readme.txt
r769751 r782629 64 64 == Changelog == 65 65 66 = 1.0.2 = 67 * Made the 'active_plugins' option log more readable by identifying which plugin was activated or deactivated. 68 66 69 = 1.0.1 = 67 70 * Added some more ignored option updates.
Note: See TracChangeset
for help on using the changeset viewer.