Esempio n. 1
0
/**
 * Collect system stats for display on the "About this system" page
 *
 * @return array
 */
function get_system_stats()
{
    global $evo_charset, $DB, $Settings, $cache_path;
    static $system_stats = array();
    if (!empty($system_stats)) {
        return $system_stats;
    }
    // b2evo config choices:
    $system_stats['mediadir_status'] = system_check_dir('media');
    // If error, then the host is potentially borked
    $system_stats['install_removed'] = system_check_install_removed();
    $system_stats['evo_charset'] = $evo_charset;
    $system_stats['evo_blog_count'] = count(system_get_blog_IDs(false));
    // Caching:
    $system_stats['cachedir_status'] = system_check_dir('cache');
    // If error, then the host is potentially borked
    $system_stats['cachedir_size'] = get_dirsize_recursive($cache_path);
    $system_stats['general_pagecache_enabled'] = $Settings->get('general_cache_enabled');
    $system_stats['blog_pagecaches_enabled'] = count(system_get_blog_IDs(true));
    // Database:
    $system_stats['db_version'] = $DB->get_version();
    // MySQL version
    $system_stats['db_utf8'] = system_check_db_utf8();
    // PHP:
    list($uid, $uname) = system_check_process_user();
    $system_stats['php_uid'] = $uid;
    $system_stats['php_uname'] = $uname;
    // Potential unsecure hosts will use names like 'nobody', 'www-data'
    list($gid, $gname) = system_check_process_group();
    $system_stats['php_gid'] = $gid;
    $system_stats['php_gname'] = $gname;
    // Potential unsecure hosts will use names like 'nobody', 'www-data'
    $system_stats['php_version'] = PHP_VERSION;
    $system_stats['php_reg_globals'] = ini_get('register_globals');
    $system_stats['php_allow_url_include'] = ini_get('allow_url_include');
    $system_stats['php_allow_url_fopen'] = ini_get('allow_url_fopen');
    // TODO php_magic quotes
    $system_stats['php_upload_max'] = system_check_upload_max_filesize();
    $system_stats['php_post_max'] = system_check_post_max_size();
    $system_stats['php_memory'] = system_check_memory_limit();
    // how much room does b2evo have to move?
    $system_stats['php_mbstring'] = extension_loaded('mbstring');
    $system_stats['php_xml'] = extension_loaded('xml');
    $system_stats['php_imap'] = extension_loaded('imap');
    $system_stats['php_opcode_cache'] = get_active_opcode_cache();
    // GD:
    $system_stats['gd_version'] = system_check_gd_version();
    return $system_stats;
}
Esempio n. 2
0
 /**
  * Add a File object to the list (by reference).
  *
  * @param File File object (by reference)
  * @param boolean Has the file to exist to get added?
  * @return boolean true on success, false on failure
  */
 function add(&$File, $mustExist = false)
 {
     if (!is_a($File, 'file')) {
         // Passed object is not a File!! :(
         return false;
     }
     // Integrity check:
     if ($File->_FileRoot->ID != $this->_FileRoot->ID) {
         debug_die('Adding file ' . $File->_FileRoot->ID . ':' . $File->get_rdfs_rel_path() . ' to filelist ' . $this->_FileRoot->ID . ' : root mismatch!');
     }
     if ($mustExist && !$File->exists()) {
         // File does not exist..
         return false;
     }
     $this->_entries[$this->_total_entries] =& $File;
     $this->_md5_ID_index[$File->get_md5_ID()] = $this->_total_entries;
     $this->_full_path_index[$File->get_full_path()] = $this->_total_entries;
     $this->_rdfs_rel_path_index[$File->get_rdfs_rel_path()] = $this->_total_entries;
     // add file to the end of current list:
     $this->_order_index[$this->_total_entries] = $this->_total_entries;
     // Count 1 more entry (file or dir)
     $this->_total_entries++;
     if ($File->is_dir()) {
         // Count 1 more directory
         $this->_total_dirs++;
         // fplanque>> TODO: get this outta here??
         // blueyed>> Where does it belong instead?
         if ($this->_use_recursive_dirsize) {
             // We want to use recursive directory sizes
             // won't be done in the File constructor
             $File->setSize(get_dirsize_recursive($File->get_full_path()));
         }
     } else {
         // Count 1 more file
         $this->_total_files++;
     }
     // Count total bytes in this dir
     $this->_total_bytes += $File->get_size();
     return true;
 }
Esempio n. 3
0
 /**
  * Get the "full" size of a file/dir (recursive for directories).
  * This is used by the FileList.
  * @return integer Recursive size of the dir or the size alone for a file.
  */
 function get_recursive_size()
 {
     if (!isset($this->_recursive_size)) {
         if ($this->is_dir()) {
             $this->_recursive_size = get_dirsize_recursive($this->get_full_path());
         } else {
             $this->_recursive_size = $this->get_size();
         }
     }
     return $this->_recursive_size;
 }