Пример #1
0
function fs_create_sites_table(&$fsdb)
{
    $sites = fs_sites_table();
    $sql = "CREATE TABLE IF NOT EXISTS `{$sites}` (\n\t\t`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY " . fs_comment('Site ID') . ",\n\t\t`type` INT NOT NULL DEFAULT '0' " . fs_comment('Site type') . ",\n\t\t`name` VARCHAR( 100 ) NOT NULL " . fs_comment('Site name') . "\n\t\t)" . fs_comment('FireStats options table') . fs_engine("InnoDB");
    $r = $fsdb->query($sql);
    if ($r === false) {
        $fsdb->debug();
        return false;
    }
    return true;
}
Пример #2
0
/**
 * System information includes:
 * Unique firestats id
 * FireStats version
 * Installation time
 * PHP version
 * MySQL version
 * Server software (apache? IIS? which version?)
 * Memory limit
 * Number of sites monitored
 * Number of sites monitored from each type (how many wordpress blogs, how many drupals etc).
 */
function fs_get_sysinfo()
{
    require_once dirname(__FILE__) . '/db-common.php';
    $s = array();
    $s["FIRESTATS_ID"] = fs_get_system_option('firestats_id');
    $s["FIRESTATS_VERSION"] = FS_VERSION;
    $s["INSTALLATION_TIME"] = fs_get_system_option('first_run_time');
    $s["PHP_VERSION"] = phpversion();
    $s["MYSQL_VERSION"] = fs_mysql_version();
    $s["SERVER_SOFTWARE"] = $_SERVER["SERVER_SOFTWARE"];
    $s["MEMOEY_LIMIT"] = ini_get('memory_limit');
    $sites_table = fs_sites_table();
    $sql = "SELECT type,COUNT(type) c from {$sites_table} GROUP BY type";
    $fsdb =& fs_get_db_conn();
    $res = $fsdb->get_results($sql);
    if ($res === false) {
        return $s;
    }
    $total = 0;
    if (count($res) > 0) {
        foreach ($res as $r) {
            $s["NUM_SITES_{$r->type}"] = $r->c;
            $total += $r->c;
        }
    }
    $s["NUM_SITES"] = $total;
    return $s;
}
Пример #3
0
function fs_get_sites()
{
    $fsdb =& fs_get_db_conn();
    $sites = fs_sites_table();
    $sql = "SELECT * FROM {$sites}";
    return $fsdb->get_results($sql, ARRAY_A);
}
Пример #4
0
function fs_get_tables_list()
{
    $a = array(fs_version_table(), fs_hits_table(), fs_useragents_table(), fs_urls_table(), fs_excluded_ips_table(), fs_bots_table(), fs_options_table(), fs_sites_table(), fs_archive_ranges(), fs_archive_sites(), fs_archive_pages(), fs_archive_referrers(), fs_archive_useragents(), fs_archive_countries(), fs_users_table(), fs_pending_date_table(), fs_url_metadata_table());
    return $a;
}