<?php
/**
* Functions and actions related to updates.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Core
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath;
use RankMath\Helper;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* Updates class
*/
class Updates implements Runner {
use Hooker;
/**
* Updates that need to be run
*
* @var array
*/
private static $updates = [
'1.0.84' => 'updates/update-1.0.84.php',
'1.0.86' => 'updates/update-1.0.86.php',
'1.0.89' => 'updates/update-1.0.89.php',
'1.0.98' => 'updates/update-1.0.98.php',
'1.0.103.1' => 'updates/update-1.0.103.1.php',
'1.0.104' => 'updates/update-1.0.104.php',
'1.0.107.3' => 'updates/update-1.0.107.3.php',
'1.0.110' => 'updates/update-1.0.110.php',
'1.0.201' => 'updates/update-1.0.201.php',
'1.0.201.1' => 'updates/update-1.0.201.1.php',
'1.0.202' => 'updates/update-1.0.202.php',
'1.0.211' => 'updates/update-1.0.211.php',
'1.0.232' => 'updates/update-1.0.232.php',
'1.0.237' => 'updates/update-1.0.237.php',
'1.0.238' => 'updates/update-1.0.238.php',
'1.0.239' => 'updates/update-1.0.239.php',
'1.0.250' => 'updates/update-1.0.250.php',
'1.0.251' => 'updates/update-1.0.251.php',
'1.0.264' => 'updates/update-1.0.264.php',
'1.0.273' => 'updates/update-1.0.273.php',
];
/**
* Register hooks.
*/
public function hooks() {
$this->action( 'admin_init', 'do_updates' );
}
/**
* Check if any update is required.
*/
public function do_updates() {
$installed_version = get_option( 'rank_math_version', '1.0.0' );
// Maybe it's the first install.
if ( ! $installed_version ) {
return;
}
if ( version_compare( $installed_version, rank_math()->version, '<' ) ) {
$this->perform_updates();
}
}
/**
* Perform all updates.
*/
public function perform_updates() {
$installed_version = get_option( 'rank_math_version', '1.0.0' );
foreach ( self::$updates as $version => $path ) {
if ( version_compare( $installed_version, $version, '<' ) ) {
include $path;
update_option( 'rank_math_version', $version );
}
}
// Save install date.
if ( false === boolval( get_option( 'rank_math_install_date' ) ) ) {
update_option( 'rank_math_install_date', Helper::get_current_time() );
}
// Clear rollback option if necessary.
if ( rank_math()->version !== get_option( 'rank_math_rollback_version' ) ) {
delete_option( 'rank_math_rollback_version' );
}
update_option( 'rank_math_version', rank_math()->version, false );
update_option( 'rank_math_db_version', rank_math()->db_version, false );
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| 3rdparty/ | 2026-07-21 14:14 | 568.06 KB | 76129f60960:kunden | dxwrx-r--r | |
| abilities/ | 2026-07-21 14:14 | 135.66 KB | 76129f60960:kunden | dxwrx-r--r | |
| admin/ | 2026-07-21 14:14 | 567.8 KB | 76129f60960:kunden | dxwrx-r--r | |
| cli/ | 2026-07-21 14:14 | 836 B | 76129f60960:kunden | dxwrx-r--r | |
| frontend/ | 2026-07-21 14:14 | 105.79 KB | 76129f60960:kunden | dxwrx-r--r | |
| helpers/ | 2026-07-21 14:14 | 138.04 KB | 76129f60960:kunden | dxwrx-r--r | |
| metaboxes/ | 2026-07-21 14:14 | 28 B | 76129f60960:kunden | dxwrx-r--r | |
| module/ | 2026-07-21 14:14 | 29.13 KB | 76129f60960:kunden | dxwrx-r--r | |
| modules/ | 2026-07-21 14:14 | 4.47 MB | 76129f60960:kunden | dxwrx-r--r | |
| opengraph/ | 2026-07-21 14:14 | 56.01 KB | 76129f60960:kunden | dxwrx-r--r | |
| replace-variables/ | 2026-07-21 14:14 | 69.13 KB | 76129f60960:kunden | dxwrx-r--r | |
| rest/ | 2026-07-21 14:14 | 56.29 KB | 76129f60960:kunden | dxwrx-r--r | |
| settings/ | 2026-07-21 14:14 | 69.92 KB | 76129f60960:kunden | dxwrx-r--r | |
| traits/ | 2026-07-21 14:14 | 12.61 KB | 76129f60960:kunden | dxwrx-r--r | |
| updates/ | 2026-07-21 14:14 | 19.48 KB | 76129f60960:kunden | dxwrx-r--r | |
| class-auto-updater.php | 2026-07-21 14:14 | 2.23 KB | 76129f60960:kunden | -xw-x----- | |
| class-cmb2.php | 2026-07-21 14:14 | 11.38 KB | 76129f60960:kunden | -xw-x----- | |
| class-common.php | 2026-07-21 14:14 | 7.02 KB | 76129f60960:kunden | -xw-x----- | |
| class-compatibility.php | 2026-07-21 14:14 | 2.52 KB | 76129f60960:kunden | -xw-x----- | |
| class-data-encryption.php | 2026-07-21 14:14 | 4.07 KB | 76129f60960:kunden | -xw-x----- | |
| class-defaults.php | 2026-07-21 14:14 | 1.13 KB | 76129f60960:kunden | -xw-x----- | |
| class-frontend-seo-score.php | 2026-07-21 14:14 | 9.78 KB | 76129f60960:kunden | -xw-x----- | |
| class-helper.php | 2026-07-21 14:14 | 11.3 KB | 76129f60960:kunden | -xw-x----- | |
| class-installer.php | 2026-07-21 14:14 | 23.4 KB | 76129f60960:kunden | -xw-x----- | |
| class-json-manager.php | 2026-07-21 14:14 | 2.78 KB | 76129f60960:kunden | -xw-x----- | |
| class-kb.php | 2026-07-21 14:14 | 12.72 KB | 76129f60960:kunden | -xw-x----- | |
| class-metadata.php | 2026-07-21 14:14 | 3.49 KB | 76129f60960:kunden | -xw-x----- | |
| class-post.php | 2026-07-21 14:14 | 4.68 KB | 76129f60960:kunden | -xw-x----- | |
| class-rewrite.php | 2026-07-21 14:14 | 9.57 KB | 76129f60960:kunden | -xw-x----- | |
| class-settings.php | 2026-07-21 14:14 | 3.41 KB | 76129f60960:kunden | -xw-x----- | |
| class-term.php | 2026-07-21 14:14 | 3.04 KB | 76129f60960:kunden | -xw-x----- | |
| class-thumbnail-overlay.php | 2026-07-21 14:14 | 7.89 KB | 76129f60960:kunden | -xw-x----- | |
| class-tracking.php | 2026-07-21 14:14 | 12.61 KB | 76129f60960:kunden | -xw-x----- | |
| class-update-email.php | 2026-07-21 14:14 | 5.27 KB | 76129f60960:kunden | -xw-x----- | |
| class-updates.php | 2026-07-21 14:14 | 2.62 KB | 76129f60960:kunden | -xw-x----- | |
| class-user.php | 2026-07-21 14:14 | 1.55 KB | 76129f60960:kunden | -xw-x----- | |
| index.php | 2026-07-21 14:14 | 28 B | 76129f60960:kunden | -xw-x----- | |
| interface-runner.php | 2026-07-21 14:14 | 380 B | 76129f60960:kunden | -xw-x----- | |
| template-tags.php | 2026-07-21 14:14 | 2.03 KB | 76129f60960:kunden | -xw-x----- | |