Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33.7
Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system
Directory :  /nas/content/live/attorneyexperi/wp-content/plugins/ugslot/MWP/Action/IncrementalBackup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /nas/content/live/attorneyexperi/wp-content/plugins/ugslot/MWP/Action/IncrementalBackup/Stats.php
<?php
/*
 * This file is part of the ManageWP Worker plugin.
 *
 * (c) ManageWP LLC <contact@managewp.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

class MWP_Action_IncrementalBackup_Stats extends MWP_Action_IncrementalBackup_AbstractFiles
{

    public function __construct()
    {
        parent::__construct();
    }

    public function execute(array $params = array())
    {

        $wpdb     = $this->container->getWordPressContext()->getDb();
        $getState = new MWP_Action_GetState();
        $getState->setContainer($this->container);
        $themesKey                         = MWP_Action_GetState::THEMES;
        $themes                            = $getState->execute(array($themesKey => array('type' => $themesKey, 'options' => array())));
        $pluginsKey                        = MWP_Action_GetState::PLUGINS;
        $plugins                           = $getState->execute(array($pluginsKey => array('type' => $pluginsKey, 'options' => array())));
        $activePlugins                     = array_filter($plugins[$pluginsKey]['result'], array($this, 'activePluginFilter'));
        $statistics                        = array();
        $statistics['themes']              = count($themes[$themesKey]['result']);
        $statistics['themes_list']         = $themes[$themesKey]['result'];
        $statistics['plugins']             = count($plugins[$pluginsKey]['result']);
        $statistics['plugins_list']        = $plugins[$pluginsKey]['result'];
        $statistics['active_plugins']      = count($activePlugins);
        $statistics['posts']               = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='post'");
        $statistics['published_posts']     = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='post' AND post_status='publish'");
        $statistics['pages']               = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='page'");
        $statistics['published_pages']     = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='page' AND post_status='publish'");
        $statistics['uploads']             = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='attachment'");
        $statistics['comments']            = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->comments} c INNER JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status = 'publish'");
        $statistics['comments_approved']   = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->comments} c INNER JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE comment_approved = 1 AND p.post_status = 'publish'");
        $latestPost                        = $wpdb->get_row("SELECT * FROM {$wpdb->posts} WHERE post_type='post' AND post_status='publish' ORDER BY ID DESC LIMIT 1");
        $statistics['latest_post_title']   = isset($latestPost->post_title) ? $latestPost->post_title : '';
        $statistics['latest_post_title']   = seems_utf8($statistics['latest_post_title']) ? $statistics['latest_post_title'] : utf8_encode($statistics['latest_post_title']);
        $statistics['latest_post_url']     = isset($latestPost) ? sprintf("%s?p=%d", get_site_url(), $latestPost->ID) : '';
        $statistics['wp_version']          = $this->container->getWordPressContext()->getVersion();
        $statistics['worker_version']      = $this->container->getParameter('worker_version');
        $currentTheme                      = $this->container->getWordPressContext()->getCurrentTheme();
        $statistics['active_theme']        = $currentTheme['Name'].' v'.$currentTheme['Version'];
        $statistics['platform']            = strtoupper(substr(PHP_OS, 0, 3));
        $statistics['external_config']     = !@file_exists(ABSPATH.'wp-config.php') && @file_exists(dirname(ABSPATH).'/wp-config.php') && !@file_exists(dirname(ABSPATH).'/wp-settings.php');
        $statistics['blog_list']           = $this->getBlogs();
        $statistics['db_prefix']           = $wpdb->prefix;
        $statistics['mu_upload_blogs_dir'] = $this->getOldMuBlogsUploadDir();

        if (!empty($params['file_count'])) {
            $paths    = !empty($params['file_paths']) ? $params['file_paths'] : array(ABSPATH);
            $pathSize = array();
            foreach ($paths as $path) {
                $pathSize[$this->replaceWindowsPath($path)] = $this->getFileCount($path);
            }
            $statistics['file_count'] = $pathSize;
        }

        return $this->createResult(array('statistic' => $statistics));
    }

    public function activePluginFilter($plugin)
    {
        return !empty($plugin['status']) && $plugin['status'] === 'active';
    }

    /**
     * @param $path
     *
     * @return int
     */
    private function getFileCount($path)
    {
        $size   = 0;
        $ignore = array('.', '..');
        $files  = @scandir($path);
        if ($files === false) {
            return 0;
        }

        foreach ($files as $file) {
            if (in_array($file, $ignore)) {
                continue;
            }
            if (is_dir(rtrim($path, '/').'/'.$file) && !is_link(rtrim($path, '/').'/'.$file)) {
                $size += $this->getFileCount(rtrim($path, '/').'/'.$file);
            } else {
                $size++;
            }
        }

        return $size;
    }

    /**
     * @return array
     */
    private function getBlogs()
    {
        $limit = 10000;
        $blogs = array();

        if (function_exists('get_sites') && class_exists('WP_Site_Query')) { // WP 4.6+
            /** @handled function */
            $sites = get_sites(array('number' => $limit));
            foreach ($sites as $site) {
                $row            = array();
                $row['blog_id'] = $site->blog_id;
                $row['domain']  = $site->domain;
                $row['path']    = $site->path;
                $blogs[]        = $row;
            }
        } elseif (function_exists('wp_get_sites')) { //WP 3.7 - 4.6
            /** @handled function */
            $sites = wp_get_sites(array('limit' => $limit));
            foreach ($sites as $site) {
                $row = array();

                $row['blog_id'] = $site['blog_id'];
                $row['domain']  = $site['domain'];
                $row['path']    = $site['path'];
                $blogs[]        = $row;
            }
        } elseif (function_exists('get_blog_list')) { // WP < 3.7
            /** @handled function */
            $sites = get_blog_list(0, 'all');
            foreach ($sites as $site) {
                $row = array();

                $row['blog_id'] = $site['blog_id'];
                $row['domain']  = $site['domain'];
                $row['path']    = $site['path'];
                $blogs[]        = $row;
            }
        }

        return $blogs;
    }

    /**
     * @return string
     */
    private function getOldMuBlogsUploadDir()
    {
        if (defined('UPLOADBLOGSDIR')) {
            return UPLOADBLOGSDIR;
        }

        return '';
    }
}

Spamworldpro Mini