Exemplo n.º 1
0
 case 'activate-indexes':
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx(resource(20))");
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx(browser(10))");
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx(searchterms(15))");
     wp_slimstat_admin::show_alert_message(__('Congrats! Slimstat is now optimized for <a href="http://www.youtube.com/watch?v=ygE01sOhzz0" target="_blank">ludicrous speed</a>.', 'wp-slimstat'), 'wp-ui-highlight below-h2');
     break;
 case 'deactivate-indexes':
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_resource_idx");
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_browser_idx");
     wp_slimstat::$wpdb->query("ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP INDEX {$GLOBALS['wpdb']->prefix}stats_searchterms_idx");
     wp_slimstat_admin::show_alert_message(__('Indexing has been disabled. Enjoy the extra database space!', 'wp-slimstat'), 'wp-ui-highlight below-h2');
     break;
 case 'delete-records':
     $rows_affected = 0;
     if (key_exists($_REQUEST['f'], wp_slimstat_db::$columns_names)) {
         $rows_affected = wp_slimstat::$wpdb->query("\n\t\t\t\t\tDELETE t1.* \n\t\t\t\t\tFROM {$GLOBALS['wpdb']->prefix}slim_stats t1\n\t\t\t\t\tWHERE " . wp_slimstat_db::get_combined_where('', '*', false));
     }
     wp_slimstat_admin::show_alert_message(intval($rows_affected) . ' ' . __('records deleted from your database.', 'wp-slimstat'), 'wp-ui-highlight below-h2');
     break;
 case 'delete-maxmind':
     @unlink(wp_slimstat::$maxmind_path);
     wp_slimstat_admin::show_alert_message(__('The geolocation database has been uninstalled from your server.', 'wp-slimstat'), 'wp-ui-highlight below-h2');
     break;
 case 'download-maxmind':
     $error = wp_slimstat::download_maxmind_database();
     if (!empty($error)) {
         wp_slimstat_admin::show_alert_message($error, 'wp-ui-notification below-h2');
     } else {
         wp_slimstat_admin::show_alert_message(__('The geolocation database has been installed on your server.', 'wp-slimstat'), 'wp-ui-highlight below-h2');
     }
     break;
Exemplo n.º 2
0
 public static function get_top_events()
 {
     if (empty(self::$filters_normalized['columns'])) {
         $from = "{$GLOBALS['wpdb']->prefix}slim_events te";
         $where = wp_slimstat_db::get_combined_where('te.type > 1', 'notes');
     } else {
         $from = "{$GLOBALS['wpdb']->prefix}slim_events te INNER JOIN {$GLOBALS['wpdb']->prefix}slim_stats t1 ON te.id = t1.id";
         $where = wp_slimstat_db::get_combined_where('te.type > 1', 'notes', true, 't1');
     }
     return self::get_results("\n\t\t\tSELECT te.notes, te.type, COUNT(*) counthits\n\t\t\tFROM {$from}\n\t\t\tWHERE {$where}\n\t\t\tGROUP BY te.notes, te.type\n\t\t\tORDER BY counthits DESC");
 }