Newer
Older

Dries Buytaert
committed

Steven Wittens
committed
define('DRUPAL_MINIMUM_PHP', '4.3.3');
define('DRUPAL_MINIMUM_MYSQL', '3.23.17'); // If using MySQL
define('DRUPAL_MINIMUM_PGSQL', '7.3'); // If using PostgreSQL
define('DRUPAL_MINIMUM_APACHE', '1.3'); // If using Apache
/**
* Test and report Drupal installation requirements.
*/
function system_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time

Steven Wittens
committed
// Report Drupal version
if ($phase == 'runtime') {
$requirements['drupal'] = array(
'title' => $t('Drupal'),
'value' => VERSION,

Steven Wittens
committed
);
}
// Test web server

Steven Wittens
committed
$requirements['webserver'] = array(
'title' => $t('Web server'),

Steven Wittens
committed
);
// Use server info string, if present.
if ($software && preg_match('![0-9]!', $software)) {
list($server, $version) = split('[ /]', $software);

Steven Wittens
committed
switch ($server) {
case 'Apache':
if (version_compare($version, DRUPAL_MINIMUM_APACHE) < 0) {
$requirements['webserver']['description'] = $t('Your Apache server is too old. Drupal requires at least Apache %version.', array('%version' => DRUPAL_MINIMUM_APACHE));
$requirements['webserver']['severity'] = REQUIREMENT_ERROR;
}
break;
default:
$requirements['webserver']['description'] = $t('The web server you\'re using has not been tested with Drupal and might not work properly.');
$requirements['webserver']['severity'] = REQUIREMENT_WARNING;
break;
}
}
else {
$requirements['webserver']['value'] = $software ? $software : $t('Unknown');
$requirements['webserver']['description'] = $t('Unable to determine your web server type and version. Drupal might not work properly.');

Steven Wittens
committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
$requirements['webserver']['severity'] = REQUIREMENT_WARNING;
}
// Test PHP version
$requirements['php'] = array(
'title' => $t('PHP'),
'value' => ($phase == 'runtime') ? l(phpversion(), 'admin/logs/status/php') : phpversion(),
);
if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) {
$requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
$requirements['php']['severity'] = REQUIREMENT_ERROR;
}
// Test DB version
global $db_type;
if (function_exists('db_status_report')) {
$requirements += db_status_report($phase);
}
// Test settings.php file writability
if ($phase == 'runtime') {
if (!drupal_verify_install_file(conf_path() .'/settings.php', FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
$requirements['settings.php'] = array(
'value' => $t('Not protected'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('The file %file is not protected from modifications and poses a security risk. You must change the file\'s permissions to be non-writable.', array('%file' => conf_path() .'/settings.php')),
);
}
else {
$requirements['settings.php'] = array(
'value' => $t('Protected'),
);
}
$requirements['settings.php']['title'] = $t('Configuration file');
}
// Report cron status
if ($phase == 'runtime') {
$cron_last = variable_get('cron_last', NULL);
if (is_numeric($cron_last)) {
$requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
}
else {
$requirements['cron'] = array(
'description' => $t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron')),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Never run'),
);
}
$requirements['cron']['description'] .= ' '. t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
$requirements['cron']['title'] = $t('Cron maintenance tasks');
}
// Test Unicode library
include_once './includes/unicode.inc';
$requirements = array_merge($requirements, unicode_requirements());
return $requirements;
}
/**
* Implementation of hook_install().
*/

Dries Buytaert
committed
function system_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {access} (

Dries Buytaert
committed
aid tinyint NOT NULL auto_increment,

Dries Buytaert
committed
mask varchar(255) NOT NULL default '',
type varchar(255) NOT NULL default '',

Dries Buytaert
committed
status tinyint NOT NULL default '0',

Dries Buytaert
committed
PRIMARY KEY (aid)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {authmap} (

Dries Buytaert
committed
aid int unsigned NOT NULL auto_increment,
uid int NOT NULL default '0',

Dries Buytaert
committed
authname varchar(128) NOT NULL default '',
module varchar(128) NOT NULL default '',
PRIMARY KEY (aid),
UNIQUE KEY authname (authname)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {blocks} (
module varchar(64) DEFAULT '' NOT NULL,
delta varchar(32) NOT NULL default '0',
theme varchar(255) NOT NULL default '',

Dries Buytaert
committed
status tinyint DEFAULT '0' NOT NULL,
weight tinyint DEFAULT '0' NOT NULL,

Dries Buytaert
committed
region varchar(64) DEFAULT 'left' NOT NULL,

Dries Buytaert
committed
custom tinyint DEFAULT '0' NOT NULL,
throttle tinyint DEFAULT '0' NOT NULL,
visibility tinyint DEFAULT '0' NOT NULL,
pages text DEFAULT '' NOT NULL,
title varchar(64) DEFAULT '' NOT NULL

Dries Buytaert
committed
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {boxes} (

Dries Buytaert
committed
bid tinyint NOT NULL auto_increment,

Dries Buytaert
committed
body longtext,
info varchar(128) NOT NULL default '',

Dries Buytaert
committed
format int NOT NULL default '0',

Dries Buytaert
committed
PRIMARY KEY (bid),
UNIQUE KEY info (info)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {cache} (
cid varchar(255) NOT NULL default '',
data longblob,

Dries Buytaert
committed
expire int NOT NULL default '0',
created int NOT NULL default '0',

Dries Buytaert
committed
headers text,
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
db_query("CREATE TABLE {cache_filter} (
cid varchar(255) NOT NULL default '',
data longblob,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {cache_menu} (
cid varchar(255) NOT NULL default '',
data longblob,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {cache_page} (
cid varchar(255) NOT NULL default '',
data longblob,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

Dries Buytaert
committed
db_query("CREATE TABLE {comments} (
Loading
Loading full blame...