| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | public $siteinfo; |
| 10 | 10 | public $bvinfo; |
| 11 | 11 | public $bvapi; |
| 12 | 12 | |
| 13 | - const INFO_WING_VERSION = 1.8; | |
| 13 | + const INFO_WING_VERSION = 1.4; | |
| 14 | 14 | |
| 15 | 15 | public function __construct($callback_handler) { |
| 16 | 16 | $this->db = $callback_handler->db; |
| 17 | 17 | $this->siteinfo = $callback_handler->siteinfo; |
| @@ -44,37 +44,8 @@ | ||
| 44 | 44 | "comments" => get_object_vars(wp_count_comments()) |
| 45 | 45 | ); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function getLatestWooCommerceDB() { | |
| 49 | - $version = false; | |
| 50 | - | |
| 51 | - if (defined('WC_ABSPATH') && file_exists(WC_ABSPATH . 'includes/class-wc-install.php')) { | |
| 52 | - include_once WC_ABSPATH . 'includes/class-wc-install.php'; | |
| 53 | - } | |
| 54 | - | |
| 55 | - if (class_exists('WC_Install')) { | |
| 56 | - $update_versions = array_keys(WC_Install::get_db_update_callbacks()); | |
| 57 | - usort($update_versions, 'version_compare'); | |
| 58 | - if (!empty($update_versions)) { | |
| 59 | - $version = end($update_versions); | |
| 60 | - } | |
| 61 | - } | |
| 62 | - | |
| 63 | - return $version; | |
| 64 | - } | |
| 65 | - | |
| 66 | - public function addDBInfoToPlugin($pdata, $plugin_file) { | |
| 67 | - switch ($plugin_file) { | |
| 68 | - case "woocommerce/woocommerce.php": | |
| 69 | - $pdata['current_db_version'] = $this->settings->getOption('woocommerce_db_version'); | |
| 70 | - $pdata['latest_db_version'] = $this->getLatestWooCommerceDB(); | |
| 71 | - break; | |
| 72 | - } | |
| 73 | - | |
| 74 | - return $pdata; | |
| 75 | - } | |
| 76 | - | |
| 77 | 48 | public function getPlugins() { |
| 78 | 49 | if (!function_exists('get_plugins')) { |
| 79 | 50 | require_once (ABSPATH."wp-admin/includes/plugin.php"); |
| 80 | 51 | } |
| @@ -87,9 +58,8 @@ | ||
| 87 | 58 | 'version' => $plugin_data['Version'], |
| 88 | 59 | 'active' => is_plugin_active($plugin_file), |
| 89 | 60 | 'network' => $plugin_data['Network'] |
| 90 | 61 | ); |
| 91 | - $pdata = $this->addDBInfoToPlugin($pdata, $plugin_file); | |
| 92 | 62 | $result["plugins"][] = $pdata; |
| 93 | 63 | } |
| 94 | 64 | return $result; |
| 95 | 65 | } |
| @@ -363,46 +333,16 @@ | ||
| 363 | 333 | $transient = $this->objectToArray($transient); |
| 364 | 334 | return array("transient" => $transient); |
| 365 | 335 | } |
| 366 | 336 | |
| 367 | - function getPluginsHandler($args = array()) { | |
| 368 | - $result = array_merge($this->getPlugins(), $this->getTransient('update_plugins')); | |
| 369 | - | |
| 370 | - if (array_key_exists('clear_filters', $args)) { | |
| 371 | - $filters = $args['clear_filters']; | |
| 372 | - foreach ($filters as $filter) | |
| 373 | - remove_all_filters($filter); | |
| 374 | - $transient_without_filters = $this->getTransient('update_plugins'); | |
| 375 | - $result['transient_without_filters'] = $transient_without_filters['transient']; | |
| 376 | - } | |
| 377 | - | |
| 378 | - return $result; | |
| 337 | + function getPluginsHandler() { | |
| 338 | + return array_merge($this->getPlugins(), $this->getTransient('update_plugins')); | |
| 379 | 339 | } |
| 380 | 340 | |
| 381 | - function getThemesHandler($args = array()) { | |
| 382 | - $result = array_merge($this->getThemes(), $this->getTransient('update_themes')); | |
| 383 | - | |
| 384 | - if (array_key_exists('clear_filters', $args)) { | |
| 385 | - $filters = $args['clear_filters']; | |
| 386 | - foreach ($filters as $filter) | |
| 387 | - remove_all_filters($filter); | |
| 388 | - $transient_without_filters = $this->getTransient('update_themes'); | |
| 389 | - $result['transient_without_filters'] = $transient_without_filters['transient']; | |
| 390 | - } | |
| 391 | - | |
| 392 | - return $result; | |
| 341 | + function getThemesHandler() { | |
| 342 | + return array_merge($this->getThemes(), $this->getTransient('update_themes')); | |
| 393 | 343 | } |
| 394 | 344 | |
| 395 | - function getCoreHandler() { | |
| 396 | - global $wp_db_version; | |
| 397 | - | |
| 398 | - $result = $this->getTransient('update_core'); | |
| 399 | - $result['current_db_version'] = $this->settings->getOption('db_version'); | |
| 400 | - $result['latest_db_version'] = $wp_db_version; | |
| 401 | - | |
| 402 | - return $result; | |
| 403 | - } | |
| 404 | - | |
| 405 | 345 | function getSiteInfo($args) { |
| 406 | 346 | $result = array(); |
| 407 | 347 | |
| 408 | 348 | if (array_key_exists('pre_refresh_get_options', $args)) { |
| @@ -417,15 +357,15 @@ | ||
| 417 | 357 | if (array_key_exists('users', $args)) |
| 418 | 358 | $result['users'] = $this->getUsersHandler($args['users']); |
| 419 | 359 | |
| 420 | 360 | if (array_key_exists('plugins', $args)) |
| 421 | - $result['plugins'] = $this->getPluginsHandler($args['plugins']); | |
| 361 | + $result['plugins'] = $this->getPluginsHandler(); | |
| 422 | 362 | |
| 423 | 363 | if (array_key_exists('themes', $args)) |
| 424 | - $result['themes'] = $this->getThemesHandler($args['themes']); | |
| 364 | + $result['themes'] = $this->getThemesHandler(); | |
| 425 | 365 | |
| 426 | 366 | if (array_key_exists('core', $args)) |
| 427 | - $result['core'] = $this->getCoreHandler(); | |
| 367 | + $result['core'] = $this->getTransient('update_core'); | |
| 428 | 368 | |
| 429 | 369 | if (array_key_exists('sys', $args)) |
| 430 | 370 | $result['sys'] = $this->getSystemInfo(); |
| 431 | 371 | |
| @@ -503,12 +443,8 @@ | ||
| 503 | 443 | $resp = $this->getPosts($params['post_type'], $count); |
| 504 | 444 | break; |
| 505 | 445 | case "gtsts": |
| 506 | 446 | $resp = $this->getStats(); |
| 507 | - break; | |
| 508 | - case "gtdbvariables": | |
| 509 | - $variable = (array_key_exists('variable', $params)) ? $variable : ""; | |
| 510 | - $resp = $this->db->showDbVariables($variable); | |
| 511 | 447 | break; |
| 512 | 448 | case "gtplgs": |
| 513 | 449 | $resp = $this->getPlugins(); |
| 514 | 450 | break; |