function getSiteStats($information = array(), $exit = true) { global $wp_version; if ($exit) { $this->updateExternalSettings(); } MainWPHelper::update_option('mainwp_child_branding_disconnected', '', 'yes'); $information['version'] = $this->version; $information['wpversion'] = $wp_version; $information['siteurl'] = get_option('siteurl'); $information['nossl'] = get_option('mainwp_child_nossl') == 1 ? 1 : 0; include_once ABSPATH . '/wp-admin/includes/update.php'; $timeout = 3 * 60 * 60; // 3minutes @set_time_limit($timeout); @ini_set('max_execution_time', $timeout); //Check for new versions if ($this->filterFunction != null) { add_filter('pre_site_transient_update_core', $this->filterFunction, 99); } if ($this->filterFunction != null) { add_filter('pre_transient_update_core', $this->filterFunction, 99); } @wp_version_check(); $core_updates = get_core_updates(); if (count($core_updates) > 0) { foreach ($core_updates as $core_update) { if ($core_update->response == 'latest') { break; } if ($core_update->response == 'upgrade' && version_compare($wp_version, $core_update->current, '<=')) { $information['wp_updates'] = $core_update->current; } } } if (!isset($information['wp_updates'])) { $information['wp_updates'] = null; } if ($this->filterFunction != null) { remove_filter('pre_site_transient_update_core', $this->filterFunction, 99); } if ($this->filterFunction != null) { remove_filter('pre_transient_update_core', $this->filterFunction, 99); } add_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins')); add_filter('option_active_plugins', array(&$this, 'default_option_active_plugins')); //First check for new premium updates $update_check = apply_filters('mwp_premium_update_check', array()); if (!empty($update_check)) { foreach ($update_check as $updateFeedback) { if (is_array($updateFeedback['callback']) && isset($updateFeedback['callback'][0]) && isset($updateFeedback['callback'][1])) { @call_user_func(array($updateFeedback['callback'][0], $updateFeedback['callback'][1])); } else { if (is_string($updateFeedback['callback'])) { @call_user_func($updateFeedback['callback']); } } } } $informationPremiumUpdates = apply_filters('mwp_premium_update_notification', array()); $premiumPlugins = array(); $premiumThemes = array(); if (is_array($informationPremiumUpdates)) { $premiumUpdates = array(); $information['premium_updates'] = array(); for ($i = 0; $i < count($informationPremiumUpdates); $i++) { if (!isset($informationPremiumUpdates[$i]['new_version'])) { continue; } $slug = isset($informationPremiumUpdates[$i]['slug']) ? $informationPremiumUpdates[$i]['slug'] : $informationPremiumUpdates[$i]['Name']; if ($informationPremiumUpdates[$i]['type'] == 'plugin') { $premiumPlugins[] = $slug; } else { if ($informationPremiumUpdates[$i]['type'] == 'theme') { $premiumThemes[] = $slug; } } $new_version = $informationPremiumUpdates[$i]['new_version']; unset($informationPremiumUpdates[$i]['old_version']); unset($informationPremiumUpdates[$i]['new_version']); $information['premium_updates'][$slug] = $informationPremiumUpdates[$i]; $information['premium_updates'][$slug]['update'] = (object) array('new_version' => $new_version, 'premium' => true, 'slug' => $slug); if (!in_array($slug, $premiumUpdates)) { $premiumUpdates[] = $slug; } } MainWPHelper::update_option('mainwp_premium_updates', $premiumUpdates); } remove_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins')); remove_filter('option_active_plugins', array(&$this, 'default_option_active_plugins')); if ($this->filterFunction != null) { add_filter('pre_site_transient_update_plugins', $this->filterFunction, 99); } global $wp_current_filter; $wp_current_filter[] = 'load-plugins.php'; @wp_update_plugins(); include_once ABSPATH . '/wp-admin/includes/plugin.php'; $plugin_updates = get_plugin_updates(); if (is_array($plugin_updates)) { $information['plugin_updates'] = array(); foreach ($plugin_updates as $slug => $plugin_update) { if (in_array($plugin_update->Name, $premiumPlugins)) { continue; } $information['plugin_updates'][$slug] = $plugin_update; } } if ($this->filterFunction != null) { remove_filter('pre_site_transient_update_plugins', $this->filterFunction, 99); } if ($this->filterFunction != null) { add_filter('pre_site_transient_update_themes', $this->filterFunction, 99); } @wp_update_themes(); include_once ABSPATH . '/wp-admin/includes/theme.php'; $theme_updates = $this->upgrade_get_theme_updates(); if (is_array($theme_updates)) { $information['theme_updates'] = array(); foreach ($theme_updates as $slug => $theme_update) { $name = is_array($theme_update) ? $theme_update['Name'] : $theme_update->Name; if (in_array($name, $premiumThemes)) { continue; } $information['theme_updates'][$slug] = $theme_update; } } if ($this->filterFunction != null) { remove_filter('pre_site_transient_update_themes', $this->filterFunction, 99); } $information['recent_comments'] = $this->get_recent_comments(array('approve', 'hold'), 5); $information['recent_posts'] = $this->get_recent_posts(array('publish', 'draft', 'pending', 'trash'), 5); $information['recent_pages'] = $this->get_recent_posts(array('publish', 'draft', 'pending', 'trash'), 5, 'page'); $securityIssuess = 0; if (!MainWPSecurity::prevent_listing_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_wp_version_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_rsd_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_wlw_ok()) { $securityIssuess++; } // if (!MainWPSecurity::remove_core_update_ok()) $securityIssuess++; // if (!MainWPSecurity::remove_plugin_update_ok()) $securityIssuess++; // if (!MainWPSecurity::remove_theme_update_ok()) $securityIssuess++; // if (!MainWPSecurity::fix_file_permissions_ok()) $securityIssuess++; if (!MainWPSecurity::remove_database_reporting_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_php_reporting_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_scripts_version_ok() || !MainWPSecurity::remove_styles_version_ok()) { $securityIssuess++; } if (!MainWPSecurity::admin_user_ok()) { $securityIssuess++; } if (!MainWPSecurity::remove_readme_ok()) { $securityIssuess++; } $information['securityIssues'] = $securityIssuess; //Directory listings! $information['directories'] = $this->scanDir(ABSPATH, 3); $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => true)); $categories = array(); foreach ($cats as $cat) { $categories[] = $cat->name; } $information['categories'] = $categories; $information['totalsize'] = $this->getTotalFileSize(); $information['dbsize'] = MainWPChildDB::get_size(); $auths = get_option('mainwp_child_auth'); $information['extauth'] = $auths && isset($auths[$this->maxHistory]) ? $auths[$this->maxHistory] : null; $plugins = $this->get_all_plugins_int(false); $themes = $this->get_all_themes_int(false); $information['plugins'] = $plugins; $information['themes'] = $themes; if (isset($_POST['optimize']) && $_POST['optimize'] == 1) { $information['users'] = $this->get_all_users_int(); } if (isset($_POST['pluginConflicts']) && $_POST['pluginConflicts'] != false) { $pluginConflicts = json_decode(stripslashes($_POST['pluginConflicts']), true); $conflicts = array(); if (count($pluginConflicts) > 0) { if ($plugins == false) { $plugins = $this->get_all_plugins_int(false); } if (is_array($plugins) && is_array($pluginConflicts)) { foreach ($plugins as $plugin) { foreach ($pluginConflicts as $pluginConflict) { if ($plugin['active'] == 1 && ($plugin['name'] == $pluginConflict || $plugin['slug'] == $pluginConflict)) { $conflicts[] = $plugin['name']; } } } } } if (count($conflicts) > 0) { $information['pluginConflicts'] = $conflicts; } } if (isset($_POST['themeConflicts']) && $_POST['themeConflicts'] != false) { $themeConflicts = json_decode(stripslashes($_POST['themeConflicts']), true); $conflicts = array(); if (is_array($themeConflicts) && count($themeConflicts) > 0) { $theme = wp_get_theme()->get('Name'); foreach ($themeConflicts as $themeConflict) { if ($theme == $themeConflict) { $conflicts[] = $theme; } } } if (count($conflicts) > 0) { $information['themeConflicts'] = $conflicts; } } if (isset($_POST['othersData'])) { $othersData = json_decode(stripslashes($_POST['othersData']), true); if (!is_array($othersData)) { $othersData = array(); } do_action("mainwp-site-sync-others-data", $othersData); if (isset($othersData['syncUpdraftData']) && $othersData['syncUpdraftData']) { if (MainWPChildUpdraftplusBackups::isActivatedUpdraftplus()) { $information['syncUpdraftData'] = MainWPChildUpdraftplusBackups::Instance()->syncData(); } } if (version_compare(phpversion(), '5.3', '>=')) { if (isset($othersData['syncBackUpWordPress']) && $othersData['syncBackUpWordPress']) { if (MainWPChildBackUpWordPress::isActivated()) { $information['syncBackUpWordPress'] = MainWPChildBackUpWordPress::Instance()->syncData(); } } } if (isset($othersData['syncWPRocketData']) && $othersData['syncWPRocketData'] == 'yes') { $data = array(); if (MainWPChildWPRocket::isActivated()) { $boxes = get_user_meta($GLOBALS['current_user']->ID, 'rocket_boxes', true); $data['rocket_boxes'] = $boxes; } $information['syncWPRocketData'] = $data; } } $information['faviIcon'] = $this->get_favicon(); $last_post = wp_get_recent_posts(array('numberposts' => absint('1'))); if (isset($last_post[0])) { $last_post = $last_post[0]; } if (isset($last_post) && isset($last_post['post_modified_gmt'])) { $information['last_post_gmt'] = strtotime($last_post['post_modified_gmt']); } $information['mainwpdir'] = MainWPHelper::validateMainWPDir() ? 1 : -1; $information['uniqueId'] = get_option('mainwp_child_uniqueId', ''); if ($exit) { MainWPHelper::write($information); } return $information; }