~ubuntu-branches/ubuntu/hardy/steam/hardy

« back to all changes in this revision

Viewing changes to server/modules/admin.pike

  • Committer: Bazaar Package Importer
  • Author(s): Alain Schroeder
  • Date: 2006-11-21 16:03:12 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061121160312-nf96y6nihzsyd2uv
Tags: 2.2.31-3
Add patch to prevent inconsistent data after shutdown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
inherit "/kernel/module";
 
2
 
 
3
#include <classes.h>
 
4
#include <database.h>
 
5
#include <events.h>
 
6
#include <macros.h>
 
7
 
 
8
 
 
9
string get_identifier() { return "admin"; }
 
10
 
 
11
/**
 
12
 * Sets a server config setting.
 
13
 * @param setting the setting to change
 
14
 * @param value the new value for the setting
 
15
 * @return true on success, false if the setting could not be changed
 
16
 */
 
17
int set_config(mixed setting, mixed value)
 
18
{
 
19
  return _Server->set_config(setting, value);
 
20
}
 
21
 
 
22
/**
 
23
 * Queries whether a server config setting is changeable. Settings that
 
24
 * are specified in the config file are not changeable in the running
 
25
 * server.
 
26
 * @param setting the setting to check
 
27
 * @return true if the setting is changeable, false if it is not changeable
 
28
 */
 
29
int is_config_changeable(mixed setting)
 
30
{
 
31
  return _Server->is_config_changeable(setting);
 
32
}
 
33
 
 
34
/**
 
35
 * Returns a server config setting.
 
36
 * @param setting the setting to query
 
37
 * @return the value of the setting, or 0 (UNDEFINED) if it doesn't exist
 
38
 */
 
39
mixed get_config(mixed setting)
 
40
{
 
41
  return _Server->get_config(setting);
 
42
}
 
43
 
 
44
/**
 
45
 * Returns a mapping with all server config settings.
 
46
 * @return a mapping ([ setting : value ])
 
47
 */
 
48
mixed get_configs()
 
49
{
 
50
  return _Server->get_configs();
 
51
}
 
52
 
 
53
/**
 
54
 * Returns the server version as a string.
 
55
 * @return the server version
 
56
 */
 
57
string get_version()
 
58
{
 
59
  return _Server->get_version();
 
60
}
 
61
 
 
62
/**
 
63
 * Returns the (unix) time (seconds after 1.1.1970) of the last server restart.
 
64
 * @return unix time of the last server restart
 
65
 */
 
66
int get_last_reboot()
 
67
{
 
68
  return _Server->get_last_reboot();
 
69
}
 
70
 
 
71
/**
 
72
 * Returns the number of objects currently in memory on the server.
 
73
 * @return number of objects in memory
 
74
 */
 
75
int get_objects_in_memory()
 
76
{
 
77
  return master()->get_in_memory();
 
78
}
 
79
 
 
80
/**
 
81
 * Returns the number of swapped objects on the server.
 
82
 * @return number of swapped objects
 
83
 */
 
84
int get_objects_swapped()
 
85
{
 
86
  return master()->get_swapped();
 
87
}
 
88
 
 
89
/**
 
90
 * Returns the memory usage of the server as a mapping. The mapping contains
 
91
 * the memory usage and count of various data types (keys in the mapping are:
 
92
 * num_programs, program_bytes,
 
93
 * num_objects, object_bytes,
 
94
 * num_strings, string_bytes,
 
95
 * num_arrays, array_bytes,
 
96
 * num_mappings, mapping_bytes,
 
97
 * num_multisets, multiset_bytes,
 
98
 * num_frames, frame_bytes,
 
99
 * num_callbacks, callback_bytes.)
 
100
 * @return memory usage information of the server
 
101
 */
 
102
mapping get_memory()
 
103
{
 
104
  return _Server->debug_memory();
 
105
}
 
106
 
 
107
/**
 
108
 * Returns the current (unix) time (seconds since 1.Jan.1970) on the server.
 
109
 * @return current unix time on the server
 
110
 */
 
111
int get_server_time ()
 
112
{
 
113
  return time();
 
114
}