/** * Create a new instance of PluginUpdate from its JSON-encoded representation. * * @param string $json * @param bool $triggerErrors * @return PluginUpdate|null */ public static function fromJson($json, $triggerErrors = false) { //Since update-related information is simply a subset of the full plugin info, //we can parse the update JSON as if it was a plugin info string, then copy over //the parts that we care about. $pluginInfo = PluginInfo::fromJson($json, $triggerErrors); if ($pluginInfo != null) { return PluginUpdate::fromPluginInfo($pluginInfo); } else { return null; } }
/** * Retrieve the latest update (if any) from the configured API endpoint. * * @uses PluginUpdateChecker::requestInfo() * * @return PluginUpdate An instance of PluginUpdate, or NULL when no updates are available. */ public function requestUpdate() { //For the sake of simplicity, this function just calls requestInfo() //and transforms the result accordingly. $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1')); if ($pluginInfo == null) { return null; } return PluginUpdate::fromPluginInfo($pluginInfo); }