| 1 |
<?php |
| 2 |
|
| 3 |
// Do not allow the file to be called directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* This class is used to log any core updates. |
| 10 |
*/ |
| 11 |
class P_Event_Core extends P_Event_Log { |
| 12 |
|
| 13 |
/** |
| 14 |
* Hook into the action so we can log it. |
| 15 |
* |
| 16 |
* @return void |
| 17 |
*/ |
| 18 |
public function __construct() { |
| 19 |
add_action( '_core_updated_successfully', array( &$this, 'eventCoreUpdatedSuccessfully' ) ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* When the core version of WordPress has been updated. |
| 24 |
* |
| 25 |
* @param string $wp_version |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
public function eventCoreUpdatedSuccessfully( $wp_version ) { |
| 29 |
global $pagenow; |
| 30 |
if ( $pagenow !== 'update-core.php' ) { |
| 31 |
$object_name = 'WordPress core automatically updated'; |
| 32 |
} else { |
| 33 |
$object_name = 'WordPress core updated'; |
| 34 |
} |
| 35 |
|
| 36 |
$this->insert( |
| 37 |
array( |
| 38 |
'action' => 'updated', |
| 39 |
'object' => 'core', |
| 40 |
'object_id' => 0, |
| 41 |
'object_name' => $object_name, |
| 42 |
) |
| 43 |
); |
| 44 |
} |
| 45 |
} |
| 46 |
|