From 5cedb389d24861a94c1183d1562900dbe59ee3fb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 23 Dec 2012 18:07:41 +0400 Subject: split self-updater gui to updater/ plugin --- plugins/updater/updater.php | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 plugins/updater/updater.php (limited to 'plugins/updater/updater.php') diff --git a/plugins/updater/updater.php b/plugins/updater/updater.php new file mode 100644 index 000000000..f88ebe409 --- /dev/null +++ b/plugins/updater/updater.php @@ -0,0 +1,76 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_PREFS_TAB, $this); + } + + function get_prefs_js() { + return file_get_contents(dirname(__FILE__) . "/updater.js"); + } + + function hook_prefs_tab($args) { + if ($args != "prefPrefs") return; + + if (($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) && CHECK_FOR_NEW_VERSION) { + print "
"; + + if ($_SESSION["pref_last_version_check"] + 86400 + rand(-1000, 1000) < time()) { + $_SESSION["version_data"] = @check_for_update($this->link); + $_SESSION["pref_last_version_check"] = time(); + } + + if (is_array($_SESSION["version_data"])) { + $version = $_SESSION["version_data"]["version"]; + print_notice(T_sprintf("New version of Tiny Tiny RSS is available (%s).", "$version")); + + print "

"; + + } else { + print_notice(__("Your Tiny Tiny RSS installation is up to date.")); + } + + print "
"; #pane + } + + function updateSelf() { + print "
"; + + print "
".__("Do not close this dialog until updating is finished. Backup your tt-rss directory before continuing.")."
"; + + print ""; + + print "
"; + print ""; + print ""; + print "
"; + print "
"; + } + + function performUpdate() { + $step = (int) $_REQUEST["step"]; + $params = json_decode($_REQUEST["params"], true); + $force = (bool) $_REQUEST["force"]; + + if (($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) && CHECK_FOR_NEW_VERSION) { + include "update_self.php"; + + print json_encode(update_self_step($this->link, $step, $params, $force)); + } + } + + + } +} +?> -- cgit v1.2.3-54-g00ecf