Open Alireza-Ghavabesh opened 3 years ago
checkForUpdates
returns an update object or null
, so if you want to check if an update is available, I would recommend a slight modification:
$result = $myUpdateChecker->checkForUpdates();
if ( $result !== null ) {
// An update is available.
}
However, this library doesn't have a download_replace()
function or anything similar. This is because it doesn't actually download or install updates. It just retrieves updates and then gives them to WordPress. Update notifications and installation are handled by WordPress core.
There probably is a way to force WordPress to install an update, but I don't know it off the top of my head. You might need to take a look at WordPress core source code, or maybe see how other tools like WP-CLI install plugin updates.
i want to do something like this:
if (check_lisense() == true) { $result = $myUpdateChecker->checkForUpdates(); //=====> only once if($result == true){ $prosess_is_compelet = $myUpdateChecker->
download_replace
(); if($prosess_is_compelet == true){do_important_work();
} } }i want to more control on process can you guide me how i can implement code above according to this library.
Thanks again for all the guidance and time you spend.