1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, update and uninstall functions for the system module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_requirements().
|
10
|
*/
|
11
|
function system_requirements($phase) {
|
12
|
global $base_url;
|
13
|
$requirements = array();
|
14
|
// Ensure translations don't break during installation.
|
15
|
$t = get_t();
|
16
|
|
17
|
// Report Drupal version
|
18
|
if ($phase == 'runtime') {
|
19
|
$requirements['drupal'] = array(
|
20
|
'title' => $t('Drupal'),
|
21
|
'value' => VERSION,
|
22
|
'severity' => REQUIREMENT_INFO,
|
23
|
'weight' => -10,
|
24
|
);
|
25
|
|
26
|
// Display the currently active installation profile, if the site
|
27
|
// is not running the default installation profile.
|
28
|
$profile = drupal_get_profile();
|
29
|
if ($profile != 'standard') {
|
30
|
$info = system_get_info('module', $profile);
|
31
|
$requirements['install_profile'] = array(
|
32
|
'title' => $t('Install profile'),
|
33
|
'value' => $t('%profile_name (%profile-%version)', array(
|
34
|
'%profile_name' => $info['name'],
|
35
|
'%profile' => $profile,
|
36
|
'%version' => $info['version']
|
37
|
)),
|
38
|
'severity' => REQUIREMENT_INFO,
|
39
|
'weight' => -9
|
40
|
);
|
41
|
}
|
42
|
}
|
43
|
|
44
|
// Web server information.
|
45
|
$software = $_SERVER['SERVER_SOFTWARE'];
|
46
|
$requirements['webserver'] = array(
|
47
|
'title' => $t('Web server'),
|
48
|
'value' => $software,
|
49
|
);
|
50
|
|
51
|
// Test PHP version and show link to phpinfo() if it's available
|
52
|
$phpversion = phpversion();
|
53
|
if (function_exists('phpinfo')) {
|
54
|
$requirements['php'] = array(
|
55
|
'title' => $t('PHP'),
|
56
|
'value' => ($phase == 'runtime') ? $phpversion .' ('. l($t('more information'), 'admin/reports/status/php') .')' : $phpversion,
|
57
|
);
|
58
|
}
|
59
|
else {
|
60
|
$requirements['php'] = array(
|
61
|
'title' => $t('PHP'),
|
62
|
'value' => $phpversion,
|
63
|
'description' => $t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information, <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array('@phpinfo' => 'http://drupal.org/node/243993')),
|
64
|
'severity' => REQUIREMENT_INFO,
|
65
|
);
|
66
|
}
|
67
|
|
68
|
if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) {
|
69
|
$requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
|
70
|
$requirements['php']['severity'] = REQUIREMENT_ERROR;
|
71
|
// If PHP is old, it's not safe to continue with the requirements check.
|
72
|
return $requirements;
|
73
|
}
|
74
|
// Check that htmlspecialchars() is secure if the site is running any PHP
|
75
|
// version older than 5.2.5. We don't simply require 5.2.5, because Ubuntu
|
76
|
// 8.04 ships with PHP 5.2.4, but includes the necessary security patch.
|
77
|
elseif (version_compare($phpversion, '5.2.5') < 0 && strlen(@htmlspecialchars(chr(0xC0) . chr(0xAF), ENT_QUOTES, 'UTF-8'))) {
|
78
|
$requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP 5.2.5, or PHP @version with the htmlspecialchars security patch backported.', array('@version' => DRUPAL_MINIMUM_PHP));
|
79
|
$requirements['php']['severity'] = REQUIREMENT_ERROR;
|
80
|
// If PHP is old, it's not safe to continue with the requirements check.
|
81
|
return $requirements;
|
82
|
}
|
83
|
|
84
|
// Test PHP register_globals setting.
|
85
|
$requirements['php_register_globals'] = array(
|
86
|
'title' => $t('PHP register globals'),
|
87
|
);
|
88
|
$register_globals = trim(ini_get('register_globals'));
|
89
|
// Unfortunately, ini_get() may return many different values, and we can't
|
90
|
// be certain which values mean 'on', so we instead check for 'not off'
|
91
|
// since we never want to tell the user that their site is secure
|
92
|
// (register_globals off), when it is in fact on. We can only guarantee
|
93
|
// register_globals is off if the value returned is 'off', '', or 0.
|
94
|
if (!empty($register_globals) && strtolower($register_globals) != 'off') {
|
95
|
$requirements['php_register_globals']['description'] = $t('<em>register_globals</em> is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when <em>register_globals</em> is enabled. The PHP manual has instructions for <a href="http://php.net/configuration.changes">how to change configuration settings</a>.');
|
96
|
$requirements['php_register_globals']['severity'] = REQUIREMENT_ERROR;
|
97
|
$requirements['php_register_globals']['value'] = $t("Enabled ('@value')", array('@value' => $register_globals));
|
98
|
}
|
99
|
else {
|
100
|
$requirements['php_register_globals']['value'] = $t('Disabled');
|
101
|
}
|
102
|
|
103
|
// Test for PHP extensions.
|
104
|
$requirements['php_extensions'] = array(
|
105
|
'title' => $t('PHP extensions'),
|
106
|
);
|
107
|
|
108
|
$missing_extensions = array();
|
109
|
$required_extensions = array(
|
110
|
'date',
|
111
|
'dom',
|
112
|
'filter',
|
113
|
'gd',
|
114
|
'hash',
|
115
|
'json',
|
116
|
'pcre',
|
117
|
'pdo',
|
118
|
'session',
|
119
|
'SimpleXML',
|
120
|
'SPL',
|
121
|
'xml',
|
122
|
);
|
123
|
foreach ($required_extensions as $extension) {
|
124
|
if (!extension_loaded($extension)) {
|
125
|
$missing_extensions[] = $extension;
|
126
|
}
|
127
|
}
|
128
|
|
129
|
if (!empty($missing_extensions)) {
|
130
|
$description = $t('Drupal requires you to enable the PHP extensions in the following list (see the <a href="@system_requirements">system requirements page</a> for more information):', array(
|
131
|
'@system_requirements' => 'http://drupal.org/requirements',
|
132
|
));
|
133
|
|
134
|
$description .= theme('item_list', array('items' => $missing_extensions));
|
135
|
|
136
|
$requirements['php_extensions']['value'] = $t('Disabled');
|
137
|
$requirements['php_extensions']['severity'] = REQUIREMENT_ERROR;
|
138
|
$requirements['php_extensions']['description'] = $description;
|
139
|
}
|
140
|
else {
|
141
|
$requirements['php_extensions']['value'] = $t('Enabled');
|
142
|
}
|
143
|
|
144
|
if ($phase == 'install' || $phase == 'update') {
|
145
|
// Test for PDO (database).
|
146
|
$requirements['database_extensions'] = array(
|
147
|
'title' => $t('Database support'),
|
148
|
);
|
149
|
|
150
|
// Make sure PDO is available.
|
151
|
$database_ok = extension_loaded('pdo');
|
152
|
if (!$database_ok) {
|
153
|
$pdo_message = $t('Your web server does not appear to support PDO (PHP Data Objects). Ask your hosting provider if they support the native PDO extension. See the <a href="@link">system requirements</a> page for more information.', array(
|
154
|
'@link' => 'http://drupal.org/requirements/pdo',
|
155
|
));
|
156
|
}
|
157
|
else {
|
158
|
// Make sure at least one supported database driver exists.
|
159
|
$drivers = drupal_detect_database_types();
|
160
|
if (empty($drivers)) {
|
161
|
$database_ok = FALSE;
|
162
|
$pdo_message = $t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array(
|
163
|
'@drupal-databases' => 'http://drupal.org/node/270#database',
|
164
|
));
|
165
|
}
|
166
|
// Make sure the native PDO extension is available, not the older PEAR
|
167
|
// version. (See install_verify_pdo() for details.)
|
168
|
if (!defined('PDO::ATTR_DEFAULT_FETCH_MODE')) {
|
169
|
$database_ok = FALSE;
|
170
|
$pdo_message = $t('Your web server seems to have the wrong version of PDO installed. Drupal 7 requires the PDO extension from PHP core. This system has the older PECL version. See the <a href="@link">system requirements</a> page for more information.', array(
|
171
|
'@link' => 'http://drupal.org/requirements/pdo#pecl',
|
172
|
));
|
173
|
}
|
174
|
}
|
175
|
|
176
|
if (!$database_ok) {
|
177
|
$requirements['database_extensions']['value'] = $t('Disabled');
|
178
|
$requirements['database_extensions']['severity'] = REQUIREMENT_ERROR;
|
179
|
$requirements['database_extensions']['description'] = $pdo_message;
|
180
|
}
|
181
|
else {
|
182
|
$requirements['database_extensions']['value'] = $t('Enabled');
|
183
|
}
|
184
|
}
|
185
|
else {
|
186
|
// Database information.
|
187
|
$class = 'DatabaseTasks_' . Database::getConnection()->driver();
|
188
|
$tasks = new $class();
|
189
|
$requirements['database_system'] = array(
|
190
|
'title' => $t('Database system'),
|
191
|
'value' => $tasks->name(),
|
192
|
);
|
193
|
$requirements['database_system_version'] = array(
|
194
|
'title' => $t('Database system version'),
|
195
|
'value' => Database::getConnection()->version(),
|
196
|
);
|
197
|
}
|
198
|
|
199
|
// Test PHP memory_limit
|
200
|
$memory_limit = ini_get('memory_limit');
|
201
|
$requirements['php_memory_limit'] = array(
|
202
|
'title' => $t('PHP memory limit'),
|
203
|
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
|
204
|
);
|
205
|
|
206
|
if (!drupal_check_memory_limit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
|
207
|
$description = '';
|
208
|
if ($phase == 'install') {
|
209
|
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
|
210
|
}
|
211
|
elseif ($phase == 'update') {
|
212
|
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
|
213
|
}
|
214
|
elseif ($phase == 'runtime') {
|
215
|
$description = $t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
|
216
|
}
|
217
|
|
218
|
if (!empty($description)) {
|
219
|
if ($php_ini_path = get_cfg_var('cfg_file_path')) {
|
220
|
$description .= ' ' . $t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', array('%configuration-file' => $php_ini_path));
|
221
|
}
|
222
|
else {
|
223
|
$description .= ' ' . $t('Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.');
|
224
|
}
|
225
|
|
226
|
$requirements['php_memory_limit']['description'] = $description . ' ' . $t('See the <a href="@url">Drupal requirements</a> for more information.', array('@url' => 'http://drupal.org/requirements'));
|
227
|
$requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
|
228
|
}
|
229
|
}
|
230
|
|
231
|
// Test settings.php file writability
|
232
|
if ($phase == 'runtime') {
|
233
|
$conf_dir = drupal_verify_install_file(conf_path(), FILE_NOT_WRITABLE, 'dir');
|
234
|
$conf_file = drupal_verify_install_file(conf_path() . '/settings.php', FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE);
|
235
|
if (!$conf_dir || !$conf_file) {
|
236
|
$requirements['settings.php'] = array(
|
237
|
'value' => $t('Not protected'),
|
238
|
'severity' => REQUIREMENT_ERROR,
|
239
|
'description' => '',
|
240
|
);
|
241
|
if (!$conf_dir) {
|
242
|
$requirements['settings.php']['description'] .= $t('The directory %file is not protected from modifications and poses a security risk. You must change the directory\'s permissions to be non-writable. ', array('%file' => conf_path()));
|
243
|
}
|
244
|
if (!$conf_file) {
|
245
|
$requirements['settings.php']['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'));
|
246
|
}
|
247
|
}
|
248
|
else {
|
249
|
$requirements['settings.php'] = array(
|
250
|
'value' => $t('Protected'),
|
251
|
);
|
252
|
}
|
253
|
$requirements['settings.php']['title'] = $t('Configuration file');
|
254
|
}
|
255
|
|
256
|
// Test the contents of the .htaccess files.
|
257
|
if ($phase == 'runtime') {
|
258
|
// Try to write the .htaccess files first, to prevent false alarms in case
|
259
|
// (for example) the /tmp directory was wiped.
|
260
|
file_ensure_htaccess();
|
261
|
$htaccess_files['public://.htaccess'] = array(
|
262
|
'title' => $t('Public files directory'),
|
263
|
'directory' => variable_get('file_public_path', conf_path() . '/files'),
|
264
|
);
|
265
|
if ($private_files_directory = variable_get('file_private_path')) {
|
266
|
$htaccess_files['private://.htaccess'] = array(
|
267
|
'title' => $t('Private files directory'),
|
268
|
'directory' => $private_files_directory,
|
269
|
);
|
270
|
}
|
271
|
$htaccess_files['temporary://.htaccess'] = array(
|
272
|
'title' => $t('Temporary files directory'),
|
273
|
'directory' => variable_get('file_temporary_path', file_directory_temp()),
|
274
|
);
|
275
|
foreach ($htaccess_files as $htaccess_file => $info) {
|
276
|
// Check for the string which was added to the recommended .htaccess file
|
277
|
// in the latest security update.
|
278
|
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
|
279
|
$requirements[$htaccess_file] = array(
|
280
|
'title' => $info['title'],
|
281
|
'value' => $t('Not fully protected'),
|
282
|
'severity' => REQUIREMENT_ERROR,
|
283
|
'description' => $t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array('@url' => 'http://drupal.org/SA-CORE-2013-003', '%directory' => $info['directory'])),
|
284
|
);
|
285
|
}
|
286
|
}
|
287
|
}
|
288
|
|
289
|
// Report cron status.
|
290
|
if ($phase == 'runtime') {
|
291
|
// Cron warning threshold defaults to two days.
|
292
|
$threshold_warning = variable_get('cron_threshold_warning', 172800);
|
293
|
// Cron error threshold defaults to two weeks.
|
294
|
$threshold_error = variable_get('cron_threshold_error', 1209600);
|
295
|
// Cron configuration help text.
|
296
|
$help = $t('For more information, see the online handbook entry for <a href="@cron-handbook">configuring cron jobs</a>.', array('@cron-handbook' => 'http://drupal.org/cron'));
|
297
|
|
298
|
// Determine when cron last ran.
|
299
|
$cron_last = variable_get('cron_last');
|
300
|
if (!is_numeric($cron_last)) {
|
301
|
$cron_last = variable_get('install_time', 0);
|
302
|
}
|
303
|
|
304
|
// Determine severity based on time since cron last ran.
|
305
|
$severity = REQUIREMENT_OK;
|
306
|
if (REQUEST_TIME - $cron_last > $threshold_error) {
|
307
|
$severity = REQUIREMENT_ERROR;
|
308
|
}
|
309
|
elseif (REQUEST_TIME - $cron_last > $threshold_warning) {
|
310
|
$severity = REQUIREMENT_WARNING;
|
311
|
}
|
312
|
|
313
|
// Set summary and description based on values determined above.
|
314
|
$summary = $t('Last run !time ago', array('!time' => format_interval(REQUEST_TIME - $cron_last)));
|
315
|
$description = '';
|
316
|
if ($severity != REQUIREMENT_OK) {
|
317
|
$description = $t('Cron has not run recently.') . ' ' . $help;
|
318
|
}
|
319
|
|
320
|
$description .= ' ' . $t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/reports/status/run-cron')));
|
321
|
$description .= '<br />' . $t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array('!cron' => url($base_url . '/cron.php', array('external' => TRUE, 'query' => array('cron_key' => variable_get('cron_key', 'drupal'))))));
|
322
|
|
323
|
$requirements['cron'] = array(
|
324
|
'title' => $t('Cron maintenance tasks'),
|
325
|
'severity' => $severity,
|
326
|
'value' => $summary,
|
327
|
'description' => $description
|
328
|
);
|
329
|
}
|
330
|
|
331
|
// Test files directories.
|
332
|
$directories = array(
|
333
|
variable_get('file_public_path', conf_path() . '/files'),
|
334
|
// By default no private files directory is configured. For private files
|
335
|
// to be secure the admin needs to provide a path outside the webroot.
|
336
|
variable_get('file_private_path', FALSE),
|
337
|
);
|
338
|
|
339
|
// Do not check for the temporary files directory during installation
|
340
|
// unless it has been set in settings.php. In this case the user has
|
341
|
// no alternative but to fix the directory if it is not writable.
|
342
|
if ($phase == 'install') {
|
343
|
$directories[] = variable_get('file_temporary_path', FALSE);
|
344
|
}
|
345
|
else {
|
346
|
$directories[] = variable_get('file_temporary_path', file_directory_temp());
|
347
|
}
|
348
|
|
349
|
$requirements['file system'] = array(
|
350
|
'title' => $t('File system'),
|
351
|
);
|
352
|
|
353
|
$error = '';
|
354
|
// For installer, create the directories if possible.
|
355
|
foreach ($directories as $directory) {
|
356
|
if (!$directory) {
|
357
|
continue;
|
358
|
}
|
359
|
if ($phase == 'install') {
|
360
|
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
|
361
|
}
|
362
|
$is_writable = is_writable($directory);
|
363
|
$is_directory = is_dir($directory);
|
364
|
if (!$is_writable || !$is_directory) {
|
365
|
$description = '';
|
366
|
$requirements['file system']['value'] = $t('Not writable');
|
367
|
if (!$is_directory) {
|
368
|
$error .= $t('The directory %directory does not exist.', array('%directory' => $directory)) . ' ';
|
369
|
}
|
370
|
else {
|
371
|
$error .= $t('The directory %directory is not writable.', array('%directory' => $directory)) . ' ';
|
372
|
}
|
373
|
// The files directory requirement check is done only during install and runtime.
|
374
|
if ($phase == 'runtime') {
|
375
|
$description = $error . $t('You may need to set the correct directory at the <a href="@admin-file-system">file system settings page</a> or change the current directory\'s permissions so that it is writable.', array('@admin-file-system' => url('admin/config/media/file-system')));
|
376
|
}
|
377
|
elseif ($phase == 'install') {
|
378
|
// For the installer UI, we need different wording. 'value' will
|
379
|
// be treated as version, so provide none there.
|
380
|
$description = $error . $t('An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the <a href="@handbook_url">online handbook</a>.', array('@handbook_url' => 'http://drupal.org/server-permissions'));
|
381
|
$requirements['file system']['value'] = '';
|
382
|
}
|
383
|
if (!empty($description)) {
|
384
|
$requirements['file system']['description'] = $description;
|
385
|
$requirements['file system']['severity'] = REQUIREMENT_ERROR;
|
386
|
}
|
387
|
}
|
388
|
else {
|
389
|
if (file_default_scheme() == 'public') {
|
390
|
$requirements['file system']['value'] = $t('Writable (<em>public</em> download method)');
|
391
|
}
|
392
|
else {
|
393
|
$requirements['file system']['value'] = $t('Writable (<em>private</em> download method)');
|
394
|
}
|
395
|
}
|
396
|
}
|
397
|
|
398
|
// See if updates are available in update.php.
|
399
|
if ($phase == 'runtime') {
|
400
|
$requirements['update'] = array(
|
401
|
'title' => $t('Database updates'),
|
402
|
'severity' => REQUIREMENT_OK,
|
403
|
'value' => $t('Up to date'),
|
404
|
);
|
405
|
|
406
|
// Check installed modules.
|
407
|
foreach (module_list() as $module) {
|
408
|
$updates = drupal_get_schema_versions($module);
|
409
|
if ($updates !== FALSE) {
|
410
|
$default = drupal_get_installed_schema_version($module);
|
411
|
if (max($updates) > $default) {
|
412
|
$requirements['update']['severity'] = REQUIREMENT_ERROR;
|
413
|
$requirements['update']['value'] = $t('Out of date');
|
414
|
$requirements['update']['description'] = $t('Some modules have database schema updates to install. You should run the <a href="@update">database update script</a> immediately.', array('@update' => base_path() . 'update.php'));
|
415
|
break;
|
416
|
}
|
417
|
}
|
418
|
}
|
419
|
}
|
420
|
|
421
|
// Verify the update.php access setting
|
422
|
if ($phase == 'runtime') {
|
423
|
if (!empty($GLOBALS['update_free_access'])) {
|
424
|
$requirements['update access'] = array(
|
425
|
'value' => $t('Not protected'),
|
426
|
'severity' => REQUIREMENT_ERROR,
|
427
|
'description' => $t('The update.php script is accessible to everyone without authentication check, which is a security risk. You must change the $update_free_access value in your settings.php back to FALSE.'),
|
428
|
);
|
429
|
}
|
430
|
else {
|
431
|
$requirements['update access'] = array(
|
432
|
'value' => $t('Protected'),
|
433
|
);
|
434
|
}
|
435
|
$requirements['update access']['title'] = $t('Access to update.php');
|
436
|
}
|
437
|
|
438
|
// Display an error if a newly introduced dependency in a module is not resolved.
|
439
|
if ($phase == 'update') {
|
440
|
$profile = drupal_get_profile();
|
441
|
$files = system_rebuild_module_data();
|
442
|
foreach ($files as $module => $file) {
|
443
|
// Ignore disabled modules and installation profiles.
|
444
|
if (!$file->status || $module == $profile) {
|
445
|
continue;
|
446
|
}
|
447
|
// Check the module's PHP version.
|
448
|
$name = $file->info['name'];
|
449
|
$php = $file->info['php'];
|
450
|
if (version_compare($php, PHP_VERSION, '>')) {
|
451
|
$requirements['php']['description'] .= $t('@name requires at least PHP @version.', array('@name' => $name, '@version' => $php));
|
452
|
$requirements['php']['severity'] = REQUIREMENT_ERROR;
|
453
|
}
|
454
|
// Check the module's required modules.
|
455
|
foreach ($file->requires as $requirement) {
|
456
|
$required_module = $requirement['name'];
|
457
|
// Check if the module exists.
|
458
|
if (!isset($files[$required_module])) {
|
459
|
$requirements["$module-$required_module"] = array(
|
460
|
'title' => $t('Unresolved dependency'),
|
461
|
'description' => $t('@name requires this module.', array('@name' => $name)),
|
462
|
'value' => t('@required_name (Missing)', array('@required_name' => $required_module)),
|
463
|
'severity' => REQUIREMENT_ERROR,
|
464
|
);
|
465
|
continue;
|
466
|
}
|
467
|
// Check for an incompatible version.
|
468
|
$required_file = $files[$required_module];
|
469
|
$required_name = $required_file->info['name'];
|
470
|
$version = str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $required_file->info['version']);
|
471
|
$compatibility = drupal_check_incompatibility($requirement, $version);
|
472
|
if ($compatibility) {
|
473
|
$compatibility = rtrim(substr($compatibility, 2), ')');
|
474
|
$requirements["$module-$required_module"] = array(
|
475
|
'title' => $t('Unresolved dependency'),
|
476
|
'description' => $t('@name requires this module and version. Currently using @required_name version @version', array('@name' => $name, '@required_name' => $required_name, '@version' => $version)),
|
477
|
'value' => t('@required_name (Version @compatibility required)', array('@required_name' => $required_name, '@compatibility' => $compatibility)),
|
478
|
'severity' => REQUIREMENT_ERROR,
|
479
|
);
|
480
|
continue;
|
481
|
}
|
482
|
}
|
483
|
}
|
484
|
}
|
485
|
|
486
|
// Test Unicode library
|
487
|
include_once DRUPAL_ROOT . '/includes/unicode.inc';
|
488
|
$requirements = array_merge($requirements, unicode_requirements());
|
489
|
|
490
|
if ($phase == 'runtime') {
|
491
|
// Check for update status module.
|
492
|
if (!module_exists('update')) {
|
493
|
$requirements['update status'] = array(
|
494
|
'value' => $t('Not enabled'),
|
495
|
'severity' => REQUIREMENT_WARNING,
|
496
|
'description' => $t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the update manager module from the <a href="@module">module administration page</a> in order to stay up-to-date on new releases. For more information, <a href="@update">Update status handbook page</a>.', array('@update' => 'http://drupal.org/documentation/modules/update', '@module' => url('admin/modules'))),
|
497
|
);
|
498
|
}
|
499
|
else {
|
500
|
$requirements['update status'] = array(
|
501
|
'value' => $t('Enabled'),
|
502
|
);
|
503
|
}
|
504
|
$requirements['update status']['title'] = $t('Update notifications');
|
505
|
|
506
|
// Check that Drupal can issue HTTP requests.
|
507
|
if (variable_get('drupal_http_request_fails', TRUE) && !system_check_http_request()) {
|
508
|
$requirements['http requests'] = array(
|
509
|
'title' => $t('HTTP request status'),
|
510
|
'value' => $t('Fails'),
|
511
|
'severity' => REQUIREMENT_ERROR,
|
512
|
'description' => $t('Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services. If you are certain that Drupal can access web pages but you are still seeing this message, you may add <code>$conf[\'drupal_http_request_fails\'] = FALSE;</code> to the bottom of your settings.php file.'),
|
513
|
);
|
514
|
}
|
515
|
}
|
516
|
|
517
|
return $requirements;
|
518
|
}
|
519
|
|
520
|
/**
|
521
|
* Implements hook_install().
|
522
|
*/
|
523
|
function system_install() {
|
524
|
// Create tables.
|
525
|
drupal_install_schema('system');
|
526
|
$versions = drupal_get_schema_versions('system');
|
527
|
$version = $versions ? max($versions) : SCHEMA_INSTALLED;
|
528
|
drupal_set_installed_schema_version('system', $version);
|
529
|
|
530
|
// Clear out module list and hook implementation statics before calling
|
531
|
// system_rebuild_theme_data().
|
532
|
module_list(TRUE);
|
533
|
module_implements('', FALSE, TRUE);
|
534
|
|
535
|
// Load system theme data appropriately.
|
536
|
system_rebuild_theme_data();
|
537
|
|
538
|
// Enable the default theme.
|
539
|
variable_set('theme_default', 'bartik');
|
540
|
db_update('system')
|
541
|
->fields(array('status' => 1))
|
542
|
->condition('type', 'theme')
|
543
|
->condition('name', 'bartik')
|
544
|
->execute();
|
545
|
|
546
|
// Populate the cron key variable.
|
547
|
$cron_key = drupal_random_key();
|
548
|
variable_set('cron_key', $cron_key);
|
549
|
}
|
550
|
|
551
|
/**
|
552
|
* Implements hook_schema().
|
553
|
*/
|
554
|
function system_schema() {
|
555
|
// NOTE: {variable} needs to be created before all other tables, as
|
556
|
// some database drivers, e.g. Oracle and DB2, will require variable_get()
|
557
|
// and variable_set() for overcoming some database specific limitations.
|
558
|
$schema['variable'] = array(
|
559
|
'description' => 'Named variable/value pairs created by Drupal core or any other module or theme. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.',
|
560
|
'fields' => array(
|
561
|
'name' => array(
|
562
|
'description' => 'The name of the variable.',
|
563
|
'type' => 'varchar',
|
564
|
'length' => 128,
|
565
|
'not null' => TRUE,
|
566
|
'default' => '',
|
567
|
),
|
568
|
'value' => array(
|
569
|
'description' => 'The value of the variable.',
|
570
|
'type' => 'blob',
|
571
|
'not null' => TRUE,
|
572
|
'size' => 'big',
|
573
|
'translatable' => TRUE,
|
574
|
),
|
575
|
),
|
576
|
'primary key' => array('name'),
|
577
|
);
|
578
|
|
579
|
$schema['actions'] = array(
|
580
|
'description' => 'Stores action information.',
|
581
|
'fields' => array(
|
582
|
'aid' => array(
|
583
|
'description' => 'Primary Key: Unique actions ID.',
|
584
|
'type' => 'varchar',
|
585
|
'length' => 255,
|
586
|
'not null' => TRUE,
|
587
|
'default' => '0',
|
588
|
),
|
589
|
'type' => array(
|
590
|
'description' => 'The object that that action acts on (node, user, comment, system or custom types.)',
|
591
|
'type' => 'varchar',
|
592
|
'length' => 32,
|
593
|
'not null' => TRUE,
|
594
|
'default' => '',
|
595
|
),
|
596
|
'callback' => array(
|
597
|
'description' => 'The callback function that executes when the action runs.',
|
598
|
'type' => 'varchar',
|
599
|
'length' => 255,
|
600
|
'not null' => TRUE,
|
601
|
'default' => '',
|
602
|
),
|
603
|
'parameters' => array(
|
604
|
'description' => 'Parameters to be passed to the callback function.',
|
605
|
'type' => 'blob',
|
606
|
'not null' => TRUE,
|
607
|
'size' => 'big',
|
608
|
),
|
609
|
'label' => array(
|
610
|
'description' => 'Label of the action.',
|
611
|
'type' => 'varchar',
|
612
|
'length' => 255,
|
613
|
'not null' => TRUE,
|
614
|
'default' => '0',
|
615
|
),
|
616
|
),
|
617
|
'primary key' => array('aid'),
|
618
|
);
|
619
|
|
620
|
$schema['batch'] = array(
|
621
|
'description' => 'Stores details about batches (processes that run in multiple HTTP requests).',
|
622
|
'fields' => array(
|
623
|
'bid' => array(
|
624
|
'description' => 'Primary Key: Unique batch ID.',
|
625
|
// This is not a serial column, to allow both progressive and
|
626
|
// non-progressive batches. See batch_process().
|
627
|
'type' => 'int',
|
628
|
'unsigned' => TRUE,
|
629
|
'not null' => TRUE,
|
630
|
),
|
631
|
'token' => array(
|
632
|
'description' => "A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.",
|
633
|
'type' => 'varchar',
|
634
|
'length' => 64,
|
635
|
'not null' => TRUE,
|
636
|
),
|
637
|
'timestamp' => array(
|
638
|
'description' => 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.',
|
639
|
'type' => 'int',
|
640
|
'not null' => TRUE,
|
641
|
),
|
642
|
'batch' => array(
|
643
|
'description' => 'A serialized array containing the processing data for the batch.',
|
644
|
'type' => 'blob',
|
645
|
'not null' => FALSE,
|
646
|
'size' => 'big',
|
647
|
),
|
648
|
),
|
649
|
'primary key' => array('bid'),
|
650
|
'indexes' => array(
|
651
|
'token' => array('token'),
|
652
|
),
|
653
|
);
|
654
|
|
655
|
$schema['blocked_ips'] = array(
|
656
|
'description' => 'Stores blocked IP addresses.',
|
657
|
'fields' => array(
|
658
|
'iid' => array(
|
659
|
'description' => 'Primary Key: unique ID for IP addresses.',
|
660
|
'type' => 'serial',
|
661
|
'unsigned' => TRUE,
|
662
|
'not null' => TRUE,
|
663
|
),
|
664
|
'ip' => array(
|
665
|
'description' => 'IP address',
|
666
|
'type' => 'varchar',
|
667
|
'length' => 40,
|
668
|
'not null' => TRUE,
|
669
|
'default' => '',
|
670
|
),
|
671
|
),
|
672
|
'indexes' => array(
|
673
|
'blocked_ip' => array('ip'),
|
674
|
),
|
675
|
'primary key' => array('iid'),
|
676
|
);
|
677
|
|
678
|
$schema['cache'] = array(
|
679
|
'description' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.',
|
680
|
'fields' => array(
|
681
|
'cid' => array(
|
682
|
'description' => 'Primary Key: Unique cache ID.',
|
683
|
'type' => 'varchar',
|
684
|
'length' => 255,
|
685
|
'not null' => TRUE,
|
686
|
'default' => '',
|
687
|
),
|
688
|
'data' => array(
|
689
|
'description' => 'A collection of data to cache.',
|
690
|
'type' => 'blob',
|
691
|
'not null' => FALSE,
|
692
|
'size' => 'big',
|
693
|
),
|
694
|
'expire' => array(
|
695
|
'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
|
696
|
'type' => 'int',
|
697
|
'not null' => TRUE,
|
698
|
'default' => 0,
|
699
|
),
|
700
|
'created' => array(
|
701
|
'description' => 'A Unix timestamp indicating when the cache entry was created.',
|
702
|
'type' => 'int',
|
703
|
'not null' => TRUE,
|
704
|
'default' => 0,
|
705
|
),
|
706
|
'serialized' => array(
|
707
|
'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
|
708
|
'type' => 'int',
|
709
|
'size' => 'small',
|
710
|
'not null' => TRUE,
|
711
|
'default' => 0,
|
712
|
),
|
713
|
),
|
714
|
'indexes' => array(
|
715
|
'expire' => array('expire'),
|
716
|
),
|
717
|
'primary key' => array('cid'),
|
718
|
);
|
719
|
$schema['cache_bootstrap'] = $schema['cache'];
|
720
|
$schema['cache_bootstrap']['description'] = 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.';
|
721
|
$schema['cache_form'] = $schema['cache'];
|
722
|
$schema['cache_form']['description'] = 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.';
|
723
|
$schema['cache_page'] = $schema['cache'];
|
724
|
$schema['cache_page']['description'] = 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.';
|
725
|
$schema['cache_menu'] = $schema['cache'];
|
726
|
$schema['cache_menu']['description'] = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.';
|
727
|
$schema['cache_path'] = $schema['cache'];
|
728
|
$schema['cache_path']['description'] = 'Cache table for path alias lookup.';
|
729
|
|
730
|
$schema['date_format_type'] = array(
|
731
|
'description' => 'Stores configured date format types.',
|
732
|
'fields' => array(
|
733
|
'type' => array(
|
734
|
'description' => 'The date format type, e.g. medium.',
|
735
|
'type' => 'varchar',
|
736
|
'length' => 64,
|
737
|
'not null' => TRUE,
|
738
|
),
|
739
|
'title' => array(
|
740
|
'description' => 'The human readable name of the format type.',
|
741
|
'type' => 'varchar',
|
742
|
'length' => 255,
|
743
|
'not null' => TRUE,
|
744
|
),
|
745
|
'locked' => array(
|
746
|
'description' => 'Whether or not this is a system provided format.',
|
747
|
'type' => 'int',
|
748
|
'size' => 'tiny',
|
749
|
'default' => 0,
|
750
|
'not null' => TRUE,
|
751
|
),
|
752
|
),
|
753
|
'primary key' => array('type'),
|
754
|
'indexes' => array(
|
755
|
'title' => array('title'),
|
756
|
),
|
757
|
);
|
758
|
|
759
|
// This table's name is plural as some versions of MySQL can't create a
|
760
|
// table named 'date_format'.
|
761
|
$schema['date_formats'] = array(
|
762
|
'description' => 'Stores configured date formats.',
|
763
|
'fields' => array(
|
764
|
'dfid' => array(
|
765
|
'description' => 'The date format identifier.',
|
766
|
'type' => 'serial',
|
767
|
'not null' => TRUE,
|
768
|
'unsigned' => TRUE,
|
769
|
),
|
770
|
'format' => array(
|
771
|
'description' => 'The date format string.',
|
772
|
'type' => 'varchar',
|
773
|
'length' => 100,
|
774
|
'not null' => TRUE,
|
775
|
'binary' => TRUE,
|
776
|
),
|
777
|
'type' => array(
|
778
|
'description' => 'The date format type, e.g. medium.',
|
779
|
'type' => 'varchar',
|
780
|
'length' => 64,
|
781
|
'not null' => TRUE,
|
782
|
),
|
783
|
'locked' => array(
|
784
|
'description' => 'Whether or not this format can be modified.',
|
785
|
'type' => 'int',
|
786
|
'size' => 'tiny',
|
787
|
'default' => 0,
|
788
|
'not null' => TRUE,
|
789
|
),
|
790
|
),
|
791
|
'primary key' => array('dfid'),
|
792
|
'unique keys' => array('formats' => array('format', 'type')),
|
793
|
);
|
794
|
|
795
|
$schema['date_format_locale'] = array(
|
796
|
'description' => 'Stores configured date formats for each locale.',
|
797
|
'fields' => array(
|
798
|
'format' => array(
|
799
|
'description' => 'The date format string.',
|
800
|
'type' => 'varchar',
|
801
|
'length' => 100,
|
802
|
'not null' => TRUE,
|
803
|
'binary' => TRUE,
|
804
|
),
|
805
|
'type' => array(
|
806
|
'description' => 'The date format type, e.g. medium.',
|
807
|
'type' => 'varchar',
|
808
|
'length' => 64,
|
809
|
'not null' => TRUE,
|
810
|
),
|
811
|
'language' => array(
|
812
|
'description' => 'A {languages}.language for this format to be used with.',
|
813
|
'type' => 'varchar',
|
814
|
'length' => 12,
|
815
|
'not null' => TRUE,
|
816
|
),
|
817
|
),
|
818
|
'primary key' => array('type', 'language'),
|
819
|
);
|
820
|
|
821
|
$schema['file_managed'] = array(
|
822
|
'description' => 'Stores information for uploaded files.',
|
823
|
'fields' => array(
|
824
|
'fid' => array(
|
825
|
'description' => 'File ID.',
|
826
|
'type' => 'serial',
|
827
|
'unsigned' => TRUE,
|
828
|
'not null' => TRUE,
|
829
|
),
|
830
|
'uid' => array(
|
831
|
'description' => 'The {users}.uid of the user who is associated with the file.',
|
832
|
'type' => 'int',
|
833
|
'unsigned' => TRUE,
|
834
|
'not null' => TRUE,
|
835
|
'default' => 0,
|
836
|
),
|
837
|
'filename' => array(
|
838
|
'description' => 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.',
|
839
|
'type' => 'varchar',
|
840
|
'length' => 255,
|
841
|
'not null' => TRUE,
|
842
|
'default' => '',
|
843
|
),
|
844
|
'uri' => array(
|
845
|
'description' => 'The URI to access the file (either local or remote).',
|
846
|
'type' => 'varchar',
|
847
|
'length' => 255,
|
848
|
'not null' => TRUE,
|
849
|
'default' => '',
|
850
|
'binary' => TRUE,
|
851
|
),
|
852
|
'filemime' => array(
|
853
|
'description' => "The file's MIME type.",
|
854
|
'type' => 'varchar',
|
855
|
'length' => 255,
|
856
|
'not null' => TRUE,
|
857
|
'default' => '',
|
858
|
),
|
859
|
'filesize' => array(
|
860
|
'description' => 'The size of the file in bytes.',
|
861
|
'type' => 'int',
|
862
|
'size' => 'big',
|
863
|
'unsigned' => TRUE,
|
864
|
'not null' => TRUE,
|
865
|
'default' => 0,
|
866
|
),
|
867
|
'status' => array(
|
868
|
'description' => 'A field indicating the status of the file. Two status are defined in core: temporary (0) and permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.',
|
869
|
'type' => 'int',
|
870
|
'not null' => TRUE,
|
871
|
'default' => 0,
|
872
|
'size' => 'tiny',
|
873
|
),
|
874
|
'timestamp' => array(
|
875
|
'description' => 'UNIX timestamp for when the file was added.',
|
876
|
'type' => 'int',
|
877
|
'unsigned' => TRUE,
|
878
|
'not null' => TRUE,
|
879
|
'default' => 0,
|
880
|
),
|
881
|
),
|
882
|
'indexes' => array(
|
883
|
'uid' => array('uid'),
|
884
|
'status' => array('status'),
|
885
|
'timestamp' => array('timestamp'),
|
886
|
),
|
887
|
'unique keys' => array(
|
888
|
'uri' => array('uri'),
|
889
|
),
|
890
|
'primary key' => array('fid'),
|
891
|
'foreign keys' => array(
|
892
|
'file_owner' => array(
|
893
|
'table' => 'users',
|
894
|
'columns' => array('uid' => 'uid'),
|
895
|
),
|
896
|
),
|
897
|
);
|
898
|
|
899
|
$schema['file_usage'] = array(
|
900
|
'description' => 'Track where a file is used.',
|
901
|
'fields' => array(
|
902
|
'fid' => array(
|
903
|
'description' => 'File ID.',
|
904
|
'type' => 'int',
|
905
|
'unsigned' => TRUE,
|
906
|
'not null' => TRUE,
|
907
|
),
|
908
|
'module' => array(
|
909
|
'description' => 'The name of the module that is using the file.',
|
910
|
'type' => 'varchar',
|
911
|
'length' => 255,
|
912
|
'not null' => TRUE,
|
913
|
'default' => '',
|
914
|
),
|
915
|
'type' => array(
|
916
|
'description' => 'The name of the object type in which the file is used.',
|
917
|
'type' => 'varchar',
|
918
|
'length' => 64,
|
919
|
'not null' => TRUE,
|
920
|
'default' => '',
|
921
|
),
|
922
|
'id' => array(
|
923
|
'description' => 'The primary key of the object using the file.',
|
924
|
'type' => 'int',
|
925
|
'unsigned' => TRUE,
|
926
|
'not null' => TRUE,
|
927
|
'default' => 0,
|
928
|
),
|
929
|
'count' => array(
|
930
|
'description' => 'The number of times this file is used by this object.',
|
931
|
'type' => 'int',
|
932
|
'unsigned' => TRUE,
|
933
|
'not null' => TRUE,
|
934
|
'default' => 0,
|
935
|
),
|
936
|
),
|
937
|
'primary key' => array('fid', 'type', 'id', 'module'),
|
938
|
'indexes' => array(
|
939
|
'type_id' => array('type', 'id'),
|
940
|
'fid_count' => array('fid', 'count'),
|
941
|
'fid_module' => array('fid', 'module'),
|
942
|
),
|
943
|
);
|
944
|
|
945
|
$schema['flood'] = array(
|
946
|
'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
|
947
|
'fields' => array(
|
948
|
'fid' => array(
|
949
|
'description' => 'Unique flood event ID.',
|
950
|
'type' => 'serial',
|
951
|
'not null' => TRUE,
|
952
|
),
|
953
|
'event' => array(
|
954
|
'description' => 'Name of event (e.g. contact).',
|
955
|
'type' => 'varchar',
|
956
|
'length' => 64,
|
957
|
'not null' => TRUE,
|
958
|
'default' => '',
|
959
|
),
|
960
|
'identifier' => array(
|
961
|
'description' => 'Identifier of the visitor, such as an IP address or hostname.',
|
962
|
'type' => 'varchar',
|
963
|
'length' => 128,
|
964
|
'not null' => TRUE,
|
965
|
'default' => '',
|
966
|
),
|
967
|
'timestamp' => array(
|
968
|
'description' => 'Timestamp of the event.',
|
969
|
'type' => 'int',
|
970
|
'not null' => TRUE,
|
971
|
'default' => 0,
|
972
|
),
|
973
|
'expiration' => array(
|
974
|
'description' => 'Expiration timestamp. Expired events are purged on cron run.',
|
975
|
'type' => 'int',
|
976
|
'not null' => TRUE,
|
977
|
'default' => 0,
|
978
|
),
|
979
|
),
|
980
|
'primary key' => array('fid'),
|
981
|
'indexes' => array(
|
982
|
'allow' => array('event', 'identifier', 'timestamp'),
|
983
|
'purge' => array('expiration'),
|
984
|
),
|
985
|
);
|
986
|
|
987
|
$schema['menu_router'] = array(
|
988
|
'description' => 'Maps paths to various callbacks (access, page and title)',
|
989
|
'fields' => array(
|
990
|
'path' => array(
|
991
|
'description' => 'Primary Key: the Drupal path this entry describes',
|
992
|
'type' => 'varchar',
|
993
|
'length' => 255,
|
994
|
'not null' => TRUE,
|
995
|
'default' => '',
|
996
|
),
|
997
|
'load_functions' => array(
|
998
|
'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.',
|
999
|
'type' => 'blob',
|
1000
|
'not null' => TRUE,
|
1001
|
),
|
1002
|
'to_arg_functions' => array(
|
1003
|
'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.',
|
1004
|
'type' => 'blob',
|
1005
|
'not null' => TRUE,
|
1006
|
),
|
1007
|
'access_callback' => array(
|
1008
|
'description' => 'The callback which determines the access to this router path. Defaults to user_access.',
|
1009
|
'type' => 'varchar',
|
1010
|
'length' => 255,
|
1011
|
'not null' => TRUE,
|
1012
|
'default' => '',
|
1013
|
),
|
1014
|
'access_arguments' => array(
|
1015
|
'description' => 'A serialized array of arguments for the access callback.',
|
1016
|
'type' => 'blob',
|
1017
|
'not null' => FALSE,
|
1018
|
),
|
1019
|
'page_callback' => array(
|
1020
|
'description' => 'The name of the function that renders the page.',
|
1021
|
'type' => 'varchar',
|
1022
|
'length' => 255,
|
1023
|
'not null' => TRUE,
|
1024
|
'default' => '',
|
1025
|
),
|
1026
|
'page_arguments' => array(
|
1027
|
'description' => 'A serialized array of arguments for the page callback.',
|
1028
|
'type' => 'blob',
|
1029
|
'not null' => FALSE,
|
1030
|
),
|
1031
|
'delivery_callback' => array(
|
1032
|
'description' => 'The name of the function that sends the result of the page_callback function to the browser.',
|
1033
|
'type' => 'varchar',
|
1034
|
'length' => 255,
|
1035
|
'not null' => TRUE,
|
1036
|
'default' => '',
|
1037
|
),
|
1038
|
'fit' => array(
|
1039
|
'description' => 'A numeric representation of how specific the path is.',
|
1040
|
'type' => 'int',
|
1041
|
'not null' => TRUE,
|
1042
|
'default' => 0,
|
1043
|
),
|
1044
|
'number_parts' => array(
|
1045
|
'description' => 'Number of parts in this router path.',
|
1046
|
'type' => 'int',
|
1047
|
'not null' => TRUE,
|
1048
|
'default' => 0,
|
1049
|
'size' => 'small',
|
1050
|
),
|
1051
|
'context' => array(
|
1052
|
'description' => 'Only for local tasks (tabs) - the context of a local task to control its placement.',
|
1053
|
'type' => 'int',
|
1054
|
'not null' => TRUE,
|
1055
|
'default' => 0,
|
1056
|
),
|
1057
|
'tab_parent' => array(
|
1058
|
'description' => 'Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).',
|
1059
|
'type' => 'varchar',
|
1060
|
'length' => 255,
|
1061
|
'not null' => TRUE,
|
1062
|
'default' => '',
|
1063
|
),
|
1064
|
'tab_root' => array(
|
1065
|
'description' => 'Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.',
|
1066
|
'type' => 'varchar',
|
1067
|
'length' => 255,
|
1068
|
'not null' => TRUE,
|
1069
|
'default' => '',
|
1070
|
),
|
1071
|
'title' => array(
|
1072
|
'description' => 'The title for the current page, or the title for the tab if this is a local task.',
|
1073
|
'type' => 'varchar',
|
1074
|
'length' => 255,
|
1075
|
'not null' => TRUE,
|
1076
|
'default' => '',
|
1077
|
),
|
1078
|
'title_callback' => array(
|
1079
|
'description' => 'A function which will alter the title. Defaults to t()',
|
1080
|
'type' => 'varchar',
|
1081
|
'length' => 255,
|
1082
|
'not null' => TRUE,
|
1083
|
'default' => '',
|
1084
|
),
|
1085
|
'title_arguments' => array(
|
1086
|
'description' => 'A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.',
|
1087
|
'type' => 'varchar',
|
1088
|
'length' => 255,
|
1089
|
'not null' => TRUE,
|
1090
|
'default' => '',
|
1091
|
),
|
1092
|
'theme_callback' => array(
|
1093
|
'description' => 'A function which returns the name of the theme that will be used to render this page. If left empty, the default theme will be used.',
|
1094
|
'type' => 'varchar',
|
1095
|
'length' => 255,
|
1096
|
'not null' => TRUE,
|
1097
|
'default' => '',
|
1098
|
),
|
1099
|
'theme_arguments' => array(
|
1100
|
'description' => 'A serialized array of arguments for the theme callback.',
|
1101
|
'type' => 'varchar',
|
1102
|
'length' => 255,
|
1103
|
'not null' => TRUE,
|
1104
|
'default' => '',
|
1105
|
),
|
1106
|
'type' => array(
|
1107
|
'description' => 'Numeric representation of the type of the menu item, like MENU_LOCAL_TASK.',
|
1108
|
'type' => 'int',
|
1109
|
'not null' => TRUE,
|
1110
|
'default' => 0,
|
1111
|
),
|
1112
|
'description' => array(
|
1113
|
'description' => 'A description of this item.',
|
1114
|
'type' => 'text',
|
1115
|
'not null' => TRUE,
|
1116
|
),
|
1117
|
'position' => array(
|
1118
|
'description' => 'The position of the block (left or right) on the system administration page for this item.',
|
1119
|
'type' => 'varchar',
|
1120
|
'length' => 255,
|
1121
|
'not null' => TRUE,
|
1122
|
'default' => '',
|
1123
|
),
|
1124
|
'weight' => array(
|
1125
|
'description' => 'Weight of the element. Lighter weights are higher up, heavier weights go down.',
|
1126
|
'type' => 'int',
|
1127
|
'not null' => TRUE,
|
1128
|
'default' => 0,
|
1129
|
),
|
1130
|
'include_file' => array(
|
1131
|
'description' => 'The file to include for this element, usually the page callback function lives in this file.',
|
1132
|
'type' => 'text',
|
1133
|
'size' => 'medium',
|
1134
|
),
|
1135
|
),
|
1136
|
'indexes' => array(
|
1137
|
'fit' => array('fit'),
|
1138
|
'tab_parent' => array(array('tab_parent', 64), 'weight', 'title'),
|
1139
|
'tab_root_weight_title' => array(array('tab_root', 64), 'weight', 'title'),
|
1140
|
),
|
1141
|
'primary key' => array('path'),
|
1142
|
);
|
1143
|
|
1144
|
$schema['menu_links'] = array(
|
1145
|
'description' => 'Contains the individual links within a menu.',
|
1146
|
'fields' => array(
|
1147
|
'menu_name' => array(
|
1148
|
'description' => "The menu name. All links with the same menu name (such as 'navigation') are part of the same menu.",
|
1149
|
'type' => 'varchar',
|
1150
|
'length' => 32,
|
1151
|
'not null' => TRUE,
|
1152
|
'default' => '',
|
1153
|
),
|
1154
|
'mlid' => array(
|
1155
|
'description' => 'The menu link ID (mlid) is the integer primary key.',
|
1156
|
'type' => 'serial',
|
1157
|
'unsigned' => TRUE,
|
1158
|
'not null' => TRUE,
|
1159
|
),
|
1160
|
'plid' => array(
|
1161
|
'description' => 'The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.',
|
1162
|
'type' => 'int',
|
1163
|
'unsigned' => TRUE,
|
1164
|
'not null' => TRUE,
|
1165
|
'default' => 0,
|
1166
|
),
|
1167
|
'link_path' => array(
|
1168
|
'description' => 'The Drupal path or external path this link points to.',
|
1169
|
'type' => 'varchar',
|
1170
|
'length' => 255,
|
1171
|
'not null' => TRUE,
|
1172
|
'default' => '',
|
1173
|
),
|
1174
|
'router_path' => array(
|
1175
|
'description' => 'For links corresponding to a Drupal path (external = 0), this connects the link to a {menu_router}.path for joins.',
|
1176
|
'type' => 'varchar',
|
1177
|
'length' => 255,
|
1178
|
'not null' => TRUE,
|
1179
|
'default' => '',
|
1180
|
),
|
1181
|
'link_title' => array(
|
1182
|
'description' => 'The text displayed for the link, which may be modified by a title callback stored in {menu_router}.',
|
1183
|
'type' => 'varchar',
|
1184
|
'length' => 255,
|
1185
|
'not null' => TRUE,
|
1186
|
'default' => '',
|
1187
|
'translatable' => TRUE,
|
1188
|
),
|
1189
|
'options' => array(
|
1190
|
'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.',
|
1191
|
'type' => 'blob',
|
1192
|
'not null' => FALSE,
|
1193
|
'translatable' => TRUE,
|
1194
|
),
|
1195
|
'module' => array(
|
1196
|
'description' => 'The name of the module that generated this link.',
|
1197
|
'type' => 'varchar',
|
1198
|
'length' => 255,
|
1199
|
'not null' => TRUE,
|
1200
|
'default' => 'system',
|
1201
|
),
|
1202
|
'hidden' => array(
|
1203
|
'description' => 'A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link)',
|
1204
|
'type' => 'int',
|
1205
|
'not null' => TRUE,
|
1206
|
'default' => 0,
|
1207
|
'size' => 'small',
|
1208
|
),
|
1209
|
'external' => array(
|
1210
|
'description' => 'A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).',
|
1211
|
'type' => 'int',
|
1212
|
'not null' => TRUE,
|
1213
|
'default' => 0,
|
1214
|
'size' => 'small',
|
1215
|
),
|
1216
|
'has_children' => array(
|
1217
|
'description' => 'Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).',
|
1218
|
'type' => 'int',
|
1219
|
'not null' => TRUE,
|
1220
|
'default' => 0,
|
1221
|
'size' => 'small',
|
1222
|
),
|
1223
|
'expanded' => array(
|
1224
|
'description' => 'Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)',
|
1225
|
'type' => 'int',
|
1226
|
'not null' => TRUE,
|
1227
|
'default' => 0,
|
1228
|
'size' => 'small',
|
1229
|
),
|
1230
|
'weight' => array(
|
1231
|
'description' => 'Link weight among links in the same menu at the same depth.',
|
1232
|
'type' => 'int',
|
1233
|
'not null' => TRUE,
|
1234
|
'default' => 0,
|
1235
|
),
|
1236
|
'depth' => array(
|
1237
|
'description' => 'The depth relative to the top level. A link with plid == 0 will have depth == 1.',
|
1238
|
'type' => 'int',
|
1239
|
'not null' => TRUE,
|
1240
|
'default' => 0,
|
1241
|
'size' => 'small',
|
1242
|
),
|
1243
|
'customized' => array(
|
1244
|
'description' => 'A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).',
|
1245
|
'type' => 'int',
|
1246
|
'not null' => TRUE,
|
1247
|
'default' => 0,
|
1248
|
'size' => 'small',
|
1249
|
),
|
1250
|
'p1' => array(
|
1251
|
'description' => 'The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.',
|
1252
|
'type' => 'int',
|
1253
|
'unsigned' => TRUE,
|
1254
|
'not null' => TRUE,
|
1255
|
'default' => 0,
|
1256
|
),
|
1257
|
'p2' => array(
|
1258
|
'description' => 'The second mlid in the materialized path. See p1.',
|
1259
|
'type' => 'int',
|
1260
|
'unsigned' => TRUE,
|
1261
|
'not null' => TRUE,
|
1262
|
'default' => 0,
|
1263
|
),
|
1264
|
'p3' => array(
|
1265
|
'description' => 'The third mlid in the materialized path. See p1.',
|
1266
|
'type' => 'int',
|
1267
|
'unsigned' => TRUE,
|
1268
|
'not null' => TRUE,
|
1269
|
'default' => 0,
|
1270
|
),
|
1271
|
'p4' => array(
|
1272
|
'description' => 'The fourth mlid in the materialized path. See p1.',
|
1273
|
'type' => 'int',
|
1274
|
'unsigned' => TRUE,
|
1275
|
'not null' => TRUE,
|
1276
|
'default' => 0,
|
1277
|
),
|
1278
|
'p5' => array(
|
1279
|
'description' => 'The fifth mlid in the materialized path. See p1.',
|
1280
|
'type' => 'int',
|
1281
|
'unsigned' => TRUE,
|
1282
|
'not null' => TRUE,
|
1283
|
'default' => 0,
|
1284
|
),
|
1285
|
'p6' => array(
|
1286
|
'description' => 'The sixth mlid in the materialized path. See p1.',
|
1287
|
'type' => 'int',
|
1288
|
'unsigned' => TRUE,
|
1289
|
'not null' => TRUE,
|
1290
|
'default' => 0,
|
1291
|
),
|
1292
|
'p7' => array(
|
1293
|
'description' => 'The seventh mlid in the materialized path. See p1.',
|
1294
|
'type' => 'int',
|
1295
|
'unsigned' => TRUE,
|
1296
|
'not null' => TRUE,
|
1297
|
'default' => 0,
|
1298
|
),
|
1299
|
'p8' => array(
|
1300
|
'description' => 'The eighth mlid in the materialized path. See p1.',
|
1301
|
'type' => 'int',
|
1302
|
'unsigned' => TRUE,
|
1303
|
'not null' => TRUE,
|
1304
|
'default' => 0,
|
1305
|
),
|
1306
|
'p9' => array(
|
1307
|
'description' => 'The ninth mlid in the materialized path. See p1.',
|
1308
|
'type' => 'int',
|
1309
|
'unsigned' => TRUE,
|
1310
|
'not null' => TRUE,
|
1311
|
'default' => 0,
|
1312
|
),
|
1313
|
'updated' => array(
|
1314
|
'description' => 'Flag that indicates that this link was generated during the update from Drupal 5.',
|
1315
|
'type' => 'int',
|
1316
|
'not null' => TRUE,
|
1317
|
'default' => 0,
|
1318
|
'size' => 'small',
|
1319
|
),
|
1320
|
),
|
1321
|
'indexes' => array(
|
1322
|
'path_menu' => array(array('link_path', 128), 'menu_name'),
|
1323
|
'menu_plid_expand_child' => array('menu_name', 'plid', 'expanded', 'has_children'),
|
1324
|
'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'),
|
1325
|
'router_path' => array(array('router_path', 128)),
|
1326
|
),
|
1327
|
'primary key' => array('mlid'),
|
1328
|
);
|
1329
|
|
1330
|
$schema['queue'] = array(
|
1331
|
'description' => 'Stores items in queues.',
|
1332
|
'fields' => array(
|
1333
|
'item_id' => array(
|
1334
|
'type' => 'serial',
|
1335
|
'unsigned' => TRUE,
|
1336
|
'not null' => TRUE,
|
1337
|
'description' => 'Primary Key: Unique item ID.',
|
1338
|
),
|
1339
|
'name' => array(
|
1340
|
'type' => 'varchar',
|
1341
|
'length' => 255,
|
1342
|
'not null' => TRUE,
|
1343
|
'default' => '',
|
1344
|
'description' => 'The queue name.',
|
1345
|
),
|
1346
|
'data' => array(
|
1347
|
'type' => 'blob',
|
1348
|
'not null' => FALSE,
|
1349
|
'size' => 'big',
|
1350
|
'serialize' => TRUE,
|
1351
|
'description' => 'The arbitrary data for the item.',
|
1352
|
),
|
1353
|
'expire' => array(
|
1354
|
'type' => 'int',
|
1355
|
'not null' => TRUE,
|
1356
|
'default' => 0,
|
1357
|
'description' => 'Timestamp when the claim lease expires on the item.',
|
1358
|
),
|
1359
|
'created' => array(
|
1360
|
'type' => 'int',
|
1361
|
'not null' => TRUE,
|
1362
|
'default' => 0,
|
1363
|
'description' => 'Timestamp when the item was created.',
|
1364
|
),
|
1365
|
),
|
1366
|
'primary key' => array('item_id'),
|
1367
|
'indexes' => array(
|
1368
|
'name_created' => array('name', 'created'),
|
1369
|
'expire' => array('expire'),
|
1370
|
),
|
1371
|
);
|
1372
|
|
1373
|
$schema['registry'] = array(
|
1374
|
'description' => "Each record is a function, class, or interface name and the file it is in.",
|
1375
|
'fields' => array(
|
1376
|
'name' => array(
|
1377
|
'description' => 'The name of the function, class, or interface.',
|
1378
|
'type' => 'varchar',
|
1379
|
'length' => 255,
|
1380
|
'not null' => TRUE,
|
1381
|
'default' => '',
|
1382
|
),
|
1383
|
'type' => array(
|
1384
|
'description' => 'Either function or class or interface.',
|
1385
|
'type' => 'varchar',
|
1386
|
'length' => 9,
|
1387
|
'not null' => TRUE,
|
1388
|
'default' => '',
|
1389
|
),
|
1390
|
'filename' => array(
|
1391
|
'description' => 'Name of the file.',
|
1392
|
'type' => 'varchar',
|
1393
|
'length' => 255,
|
1394
|
'not null' => TRUE,
|
1395
|
),
|
1396
|
'module' => array(
|
1397
|
'description' => 'Name of the module the file belongs to.',
|
1398
|
'type' => 'varchar',
|
1399
|
'length' => 255,
|
1400
|
'not null' => TRUE,
|
1401
|
'default' => ''
|
1402
|
),
|
1403
|
'weight' => array(
|
1404
|
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
|
1405
|
'type' => 'int',
|
1406
|
'not null' => TRUE,
|
1407
|
'default' => 0,
|
1408
|
),
|
1409
|
),
|
1410
|
'primary key' => array('name', 'type'),
|
1411
|
'indexes' => array(
|
1412
|
'hook' => array('type', 'weight', 'module'),
|
1413
|
),
|
1414
|
);
|
1415
|
|
1416
|
$schema['registry_file'] = array(
|
1417
|
'description' => "Files parsed to build the registry.",
|
1418
|
'fields' => array(
|
1419
|
'filename' => array(
|
1420
|
'description' => 'Path to the file.',
|
1421
|
'type' => 'varchar',
|
1422
|
'length' => 255,
|
1423
|
'not null' => TRUE,
|
1424
|
),
|
1425
|
'hash' => array(
|
1426
|
'description' => "sha-256 hash of the file's contents when last parsed.",
|
1427
|
'type' => 'varchar',
|
1428
|
'length' => 64,
|
1429
|
'not null' => TRUE,
|
1430
|
),
|
1431
|
),
|
1432
|
'primary key' => array('filename'),
|
1433
|
);
|
1434
|
|
1435
|
$schema['semaphore'] = array(
|
1436
|
'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
|
1437
|
'fields' => array(
|
1438
|
'name' => array(
|
1439
|
'description' => 'Primary Key: Unique name.',
|
1440
|
'type' => 'varchar',
|
1441
|
'length' => 255,
|
1442
|
'not null' => TRUE,
|
1443
|
'default' => ''
|
1444
|
),
|
1445
|
'value' => array(
|
1446
|
'description' => 'A value for the semaphore.',
|
1447
|
'type' => 'varchar',
|
1448
|
'length' => 255,
|
1449
|
'not null' => TRUE,
|
1450
|
'default' => ''
|
1451
|
),
|
1452
|
'expire' => array(
|
1453
|
'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
|
1454
|
'type' => 'float',
|
1455
|
'size' => 'big',
|
1456
|
'not null' => TRUE
|
1457
|
),
|
1458
|
),
|
1459
|
'indexes' => array(
|
1460
|
'value' => array('value'),
|
1461
|
'expire' => array('expire'),
|
1462
|
),
|
1463
|
'primary key' => array('name'),
|
1464
|
);
|
1465
|
|
1466
|
$schema['sequences'] = array(
|
1467
|
'description' => 'Stores IDs.',
|
1468
|
'fields' => array(
|
1469
|
'value' => array(
|
1470
|
'description' => 'The value of the sequence.',
|
1471
|
'type' => 'serial',
|
1472
|
'unsigned' => TRUE,
|
1473
|
'not null' => TRUE,
|
1474
|
),
|
1475
|
),
|
1476
|
'primary key' => array('value'),
|
1477
|
);
|
1478
|
|
1479
|
$schema['sessions'] = array(
|
1480
|
'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
|
1481
|
'fields' => array(
|
1482
|
'uid' => array(
|
1483
|
'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
|
1484
|
'type' => 'int',
|
1485
|
'unsigned' => TRUE,
|
1486
|
'not null' => TRUE,
|
1487
|
),
|
1488
|
'sid' => array(
|
1489
|
'description' => "A session ID. The value is generated by Drupal's session handlers.",
|
1490
|
'type' => 'varchar',
|
1491
|
'length' => 128,
|
1492
|
'not null' => TRUE,
|
1493
|
),
|
1494
|
'ssid' => array(
|
1495
|
'description' => "Secure session ID. The value is generated by Drupal's session handlers.",
|
1496
|
'type' => 'varchar',
|
1497
|
'length' => 128,
|
1498
|
'not null' => TRUE,
|
1499
|
'default' => '',
|
1500
|
),
|
1501
|
'hostname' => array(
|
1502
|
'description' => 'The IP address that last used this session ID (sid).',
|
1503
|
'type' => 'varchar',
|
1504
|
'length' => 128,
|
1505
|
'not null' => TRUE,
|
1506
|
'default' => '',
|
1507
|
),
|
1508
|
'timestamp' => array(
|
1509
|
'description' => 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.',
|
1510
|
'type' => 'int',
|
1511
|
'not null' => TRUE,
|
1512
|
'default' => 0,
|
1513
|
),
|
1514
|
'cache' => array(
|
1515
|
'description' => "The time of this user's last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get().",
|
1516
|
'type' => 'int',
|
1517
|
'not null' => TRUE,
|
1518
|
'default' => 0,
|
1519
|
),
|
1520
|
'session' => array(
|
1521
|
'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
|
1522
|
'type' => 'blob',
|
1523
|
'not null' => FALSE,
|
1524
|
'size' => 'big',
|
1525
|
),
|
1526
|
),
|
1527
|
'primary key' => array(
|
1528
|
'sid',
|
1529
|
'ssid',
|
1530
|
),
|
1531
|
'indexes' => array(
|
1532
|
'timestamp' => array('timestamp'),
|
1533
|
'uid' => array('uid'),
|
1534
|
'ssid' => array('ssid'),
|
1535
|
),
|
1536
|
'foreign keys' => array(
|
1537
|
'session_user' => array(
|
1538
|
'table' => 'users',
|
1539
|
'columns' => array('uid' => 'uid'),
|
1540
|
),
|
1541
|
),
|
1542
|
);
|
1543
|
|
1544
|
$schema['system'] = array(
|
1545
|
'description' => "A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system.",
|
1546
|
'fields' => array(
|
1547
|
'filename' => array(
|
1548
|
'description' => 'The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.',
|
1549
|
'type' => 'varchar',
|
1550
|
'length' => 255,
|
1551
|
'not null' => TRUE,
|
1552
|
'default' => '',
|
1553
|
),
|
1554
|
'name' => array(
|
1555
|
'description' => 'The name of the item; e.g. node.',
|
1556
|
'type' => 'varchar',
|
1557
|
'length' => 255,
|
1558
|
'not null' => TRUE,
|
1559
|
'default' => '',
|
1560
|
),
|
1561
|
'type' => array(
|
1562
|
'description' => 'The type of the item, either module, theme, or theme_engine.',
|
1563
|
'type' => 'varchar',
|
1564
|
'length' => 12,
|
1565
|
'not null' => TRUE,
|
1566
|
'default' => '',
|
1567
|
),
|
1568
|
'owner' => array(
|
1569
|
'description' => "A theme's 'parent' . Can be either a theme or an engine.",
|
1570
|
'type' => 'varchar',
|
1571
|
'length' => 255,
|
1572
|
'not null' => TRUE,
|
1573
|
'default' => '',
|
1574
|
),
|
1575
|
'status' => array(
|
1576
|
'description' => 'Boolean indicating whether or not this item is enabled.',
|
1577
|
'type' => 'int',
|
1578
|
'not null' => TRUE,
|
1579
|
'default' => 0,
|
1580
|
),
|
1581
|
'bootstrap' => array(
|
1582
|
'description' => "Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted).",
|
1583
|
'type' => 'int',
|
1584
|
'not null' => TRUE,
|
1585
|
'default' => 0,
|
1586
|
),
|
1587
|
'schema_version' => array(
|
1588
|
'description' => "The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed.",
|
1589
|
'type' => 'int',
|
1590
|
'not null' => TRUE,
|
1591
|
'default' => -1,
|
1592
|
'size' => 'small',
|
1593
|
),
|
1594
|
'weight' => array(
|
1595
|
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
|
1596
|
'type' => 'int',
|
1597
|
'not null' => TRUE,
|
1598
|
'default' => 0,
|
1599
|
),
|
1600
|
'info' => array(
|
1601
|
'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, and php.",
|
1602
|
'type' => 'blob',
|
1603
|
'not null' => FALSE,
|
1604
|
),
|
1605
|
),
|
1606
|
'primary key' => array('filename'),
|
1607
|
'indexes' => array(
|
1608
|
'system_list' => array('status', 'bootstrap', 'type', 'weight', 'name'),
|
1609
|
'type_name' => array('type', 'name'),
|
1610
|
),
|
1611
|
);
|
1612
|
|
1613
|
$schema['url_alias'] = array(
|
1614
|
'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.',
|
1615
|
'fields' => array(
|
1616
|
'pid' => array(
|
1617
|
'description' => 'A unique path alias identifier.',
|
1618
|
'type' => 'serial',
|
1619
|
'unsigned' => TRUE,
|
1620
|
'not null' => TRUE,
|
1621
|
),
|
1622
|
'source' => array(
|
1623
|
'description' => 'The Drupal path this alias is for; e.g. node/12.',
|
1624
|
'type' => 'varchar',
|
1625
|
'length' => 255,
|
1626
|
'not null' => TRUE,
|
1627
|
'default' => '',
|
1628
|
),
|
1629
|
'alias' => array(
|
1630
|
'description' => 'The alias for this path; e.g. title-of-the-story.',
|
1631
|
'type' => 'varchar',
|
1632
|
'length' => 255,
|
1633
|
'not null' => TRUE,
|
1634
|
'default' => '',
|
1635
|
),
|
1636
|
'language' => array(
|
1637
|
'description' => "The language this alias is for; if 'und', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.",
|
1638
|
'type' => 'varchar',
|
1639
|
'length' => 12,
|
1640
|
'not null' => TRUE,
|
1641
|
'default' => '',
|
1642
|
),
|
1643
|
),
|
1644
|
'primary key' => array('pid'),
|
1645
|
'indexes' => array(
|
1646
|
'alias_language_pid' => array('alias', 'language', 'pid'),
|
1647
|
'source_language_pid' => array('source', 'language', 'pid'),
|
1648
|
),
|
1649
|
);
|
1650
|
|
1651
|
return $schema;
|
1652
|
}
|
1653
|
|
1654
|
/**
|
1655
|
* The cache schema corresponding to system_update_7054.
|
1656
|
*
|
1657
|
* Drupal 7 adds several new cache tables. Since they all have identical schema
|
1658
|
* this helper function allows them to re-use the same definition, without
|
1659
|
* relying on system_schema(), which may change with future updates.
|
1660
|
*/
|
1661
|
function system_schema_cache_7054() {
|
1662
|
return array(
|
1663
|
'description' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.',
|
1664
|
'fields' => array(
|
1665
|
'cid' => array(
|
1666
|
'description' => 'Primary Key: Unique cache ID.',
|
1667
|
'type' => 'varchar',
|
1668
|
'length' => 255,
|
1669
|
'not null' => TRUE,
|
1670
|
'default' => '',
|
1671
|
),
|
1672
|
'data' => array(
|
1673
|
'description' => 'A collection of data to cache.',
|
1674
|
'type' => 'blob',
|
1675
|
'not null' => FALSE,
|
1676
|
'size' => 'big',
|
1677
|
),
|
1678
|
'expire' => array(
|
1679
|
'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
|
1680
|
'type' => 'int',
|
1681
|
'not null' => TRUE,
|
1682
|
'default' => 0,
|
1683
|
),
|
1684
|
'created' => array(
|
1685
|
'description' => 'A Unix timestamp indicating when the cache entry was created.',
|
1686
|
'type' => 'int',
|
1687
|
'not null' => TRUE,
|
1688
|
'default' => 0,
|
1689
|
),
|
1690
|
'serialized' => array(
|
1691
|
'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
|
1692
|
'type' => 'int',
|
1693
|
'size' => 'small',
|
1694
|
'not null' => TRUE,
|
1695
|
'default' => 0,
|
1696
|
),
|
1697
|
),
|
1698
|
'indexes' => array(
|
1699
|
'expire' => array('expire'),
|
1700
|
),
|
1701
|
'primary key' => array('cid'),
|
1702
|
);
|
1703
|
}
|
1704
|
|
1705
|
|
1706
|
// Updates for core.
|
1707
|
|
1708
|
function system_update_last_removed() {
|
1709
|
return 6055;
|
1710
|
}
|
1711
|
|
1712
|
/**
|
1713
|
* Implements hook_update_dependencies().
|
1714
|
*/
|
1715
|
function system_update_dependencies() {
|
1716
|
// system_update_7053() queries the {block} table, so it must run after
|
1717
|
// block_update_7002(), which creates that table.
|
1718
|
$dependencies['system'][7053] = array(
|
1719
|
'block' => 7002,
|
1720
|
);
|
1721
|
|
1722
|
// system_update_7061() queries the {node_revision} table, so it must run
|
1723
|
// after node_update_7001(), which renames the {node_revisions} table.
|
1724
|
$dependencies['system'][7061] = array(
|
1725
|
'node' => 7001,
|
1726
|
);
|
1727
|
|
1728
|
// system_update_7067() migrates role permissions and therefore must run
|
1729
|
// after the {role} and {role_permission} tables are properly set up, which
|
1730
|
// happens in user_update_7007().
|
1731
|
$dependencies['system'][7067] = array(
|
1732
|
'user' => 7007,
|
1733
|
);
|
1734
|
|
1735
|
return $dependencies;
|
1736
|
}
|
1737
|
|
1738
|
/**
|
1739
|
* @defgroup updates-6.x-to-7.x Updates from 6.x to 7.x
|
1740
|
* @{
|
1741
|
* Update functions from 6.x to 7.x.
|
1742
|
*/
|
1743
|
|
1744
|
/**
|
1745
|
* Rename blog and forum permissions to be consistent with other content types.
|
1746
|
*/
|
1747
|
function system_update_7000() {
|
1748
|
$result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
|
1749
|
foreach ($result as $role) {
|
1750
|
$renamed_permission = $role->perm;
|
1751
|
$renamed_permission = preg_replace('/(?<=^|,\ )create\ blog\ entries(?=,|$)/', 'create blog content', $renamed_permission);
|
1752
|
$renamed_permission = preg_replace('/(?<=^|,\ )edit\ own\ blog\ entries(?=,|$)/', 'edit own blog content', $renamed_permission);
|
1753
|
$renamed_permission = preg_replace('/(?<=^|,\ )edit\ any\ blog\ entry(?=,|$)/', 'edit any blog content', $renamed_permission);
|
1754
|
$renamed_permission = preg_replace('/(?<=^|,\ )delete\ own\ blog\ entries(?=,|$)/', 'delete own blog content', $renamed_permission);
|
1755
|
$renamed_permission = preg_replace('/(?<=^|,\ )delete\ any\ blog\ entry(?=,|$)/', 'delete any blog content', $renamed_permission);
|
1756
|
|
1757
|
$renamed_permission = preg_replace('/(?<=^|,\ )create\ forum\ topics(?=,|$)/', 'create forum content', $renamed_permission);
|
1758
|
$renamed_permission = preg_replace('/(?<=^|,\ )delete\ any\ forum\ topic(?=,|$)/', 'delete any forum content', $renamed_permission);
|
1759
|
$renamed_permission = preg_replace('/(?<=^|,\ )delete\ own\ forum\ topics(?=,|$)/', 'delete own forum content', $renamed_permission);
|
1760
|
$renamed_permission = preg_replace('/(?<=^|,\ )edit\ any\ forum\ topic(?=,|$)/', 'edit any forum content', $renamed_permission);
|
1761
|
$renamed_permission = preg_replace('/(?<=^|,\ )edit\ own\ forum\ topics(?=,|$)/', 'edit own forum content', $renamed_permission);
|
1762
|
|
1763
|
if ($renamed_permission != $role->perm) {
|
1764
|
db_update('permission')
|
1765
|
->fields(array('perm' => $renamed_permission))
|
1766
|
->condition('rid', $role->rid)
|
1767
|
->execute();
|
1768
|
}
|
1769
|
}
|
1770
|
}
|
1771
|
|
1772
|
/**
|
1773
|
* Generate a cron key and save it in the variables table.
|
1774
|
*/
|
1775
|
function system_update_7001() {
|
1776
|
variable_set('cron_key', drupal_random_key());
|
1777
|
}
|
1778
|
|
1779
|
/**
|
1780
|
* Add a table to store blocked IP addresses.
|
1781
|
*/
|
1782
|
function system_update_7002() {
|
1783
|
$schema['blocked_ips'] = array(
|
1784
|
'description' => 'Stores blocked IP addresses.',
|
1785
|
'fields' => array(
|
1786
|
'iid' => array(
|
1787
|
'description' => 'Primary Key: unique ID for IP addresses.',
|
1788
|
'type' => 'serial',
|
1789
|
'unsigned' => TRUE,
|
1790
|
'not null' => TRUE,
|
1791
|
),
|
1792
|
'ip' => array(
|
1793
|
'description' => 'IP address',
|
1794
|
'type' => 'varchar',
|
1795
|
'length' => 32,
|
1796
|
'not null' => TRUE,
|
1797
|
'default' => '',
|
1798
|
),
|
1799
|
),
|
1800
|
'indexes' => array(
|
1801
|
'blocked_ip' => array('ip'),
|
1802
|
),
|
1803
|
'primary key' => array('iid'),
|
1804
|
);
|
1805
|
|
1806
|
db_create_table('blocked_ips', $schema['blocked_ips']);
|
1807
|
}
|
1808
|
|
1809
|
/**
|
1810
|
* Update {blocked_ips} with valid IP addresses from {access}.
|
1811
|
*/
|
1812
|
function system_update_7003() {
|
1813
|
$messages = array();
|
1814
|
$type = 'host';
|
1815
|
$result = db_query("SELECT mask FROM {access} WHERE status = :status AND type = :type", array(
|
1816
|
':status' => 0,
|
1817
|
':type' => $type,
|
1818
|
));
|
1819
|
foreach ($result as $blocked) {
|
1820
|
if (filter_var($blocked->mask, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) !== FALSE) {
|
1821
|
db_insert('blocked_ips')
|
1822
|
->fields(array('ip' => $blocked->mask))
|
1823
|
->execute();
|
1824
|
}
|
1825
|
else {
|
1826
|
$invalid_host = check_plain($blocked->mask);
|
1827
|
$messages[] = t('The host !host is no longer blocked because it is not a valid IP address.', array('!host' => $invalid_host ));
|
1828
|
}
|
1829
|
}
|
1830
|
if (isset($invalid_host)) {
|
1831
|
drupal_set_message('Drupal no longer supports wildcard IP address blocking. Visitors whose IP addresses match ranges you have previously set using <em>access rules</em> will no longer be blocked from your site when you put the site online. See the <a href="http://drupal.org/node/24302">IP address and referrer blocking Handbook page</a> for alternative methods.', 'warning');
|
1832
|
}
|
1833
|
// Make sure not to block any IP addresses that were specifically allowed by access rules.
|
1834
|
if (!empty($result)) {
|
1835
|
$result = db_query("SELECT mask FROM {access} WHERE status = :status AND type = :type", array(
|
1836
|
':status' => 1,
|
1837
|
':type' => $type,
|
1838
|
));
|
1839
|
$or = db_condition('or');
|
1840
|
foreach ($result as $allowed) {
|
1841
|
$or->condition('ip', $allowed->mask, 'LIKE');
|
1842
|
}
|
1843
|
if (count($or)) {
|
1844
|
db_delete('blocked_ips')
|
1845
|
->condition($or)
|
1846
|
->execute();
|
1847
|
}
|
1848
|
}
|
1849
|
}
|
1850
|
|
1851
|
/**
|
1852
|
* Remove hardcoded numeric deltas from all blocks in core.
|
1853
|
*/
|
1854
|
function system_update_7004(&$sandbox) {
|
1855
|
// Get an array of the renamed block deltas, organized by module.
|
1856
|
$renamed_deltas = array(
|
1857
|
'blog' => array('0' => 'recent'),
|
1858
|
'book' => array('0' => 'navigation'),
|
1859
|
'comment' => array('0' => 'recent'),
|
1860
|
'forum' => array(
|
1861
|
'0' => 'active',
|
1862
|
'1' => 'new',
|
1863
|
),
|
1864
|
'locale' => array('0' => LANGUAGE_TYPE_INTERFACE),
|
1865
|
'node' => array('0' => 'syndicate'),
|
1866
|
'poll' => array('0' => 'recent'),
|
1867
|
'profile' => array('0' => 'author-information'),
|
1868
|
'search' => array('0' => 'form'),
|
1869
|
'statistics' => array('0' => 'popular'),
|
1870
|
'system' => array('0' => 'powered-by'),
|
1871
|
'user' => array(
|
1872
|
'0' => 'login',
|
1873
|
'1' => 'navigation',
|
1874
|
'2' => 'new',
|
1875
|
'3' => 'online',
|
1876
|
),
|
1877
|
);
|
1878
|
|
1879
|
$moved_deltas = array(
|
1880
|
'user' => array('navigation' => 'system'),
|
1881
|
);
|
1882
|
|
1883
|
// Only run this the first time through the batch update.
|
1884
|
if (!isset($sandbox['progress'])) {
|
1885
|
// Rename forum module's block variables.
|
1886
|
$forum_block_num_0 = variable_get('forum_block_num_0');
|
1887
|
if (isset($forum_block_num_0)) {
|
1888
|
variable_set('forum_block_num_active', $forum_block_num_0);
|
1889
|
variable_del('forum_block_num_0');
|
1890
|
}
|
1891
|
$forum_block_num_1 = variable_get('forum_block_num_1');
|
1892
|
if (isset($forum_block_num_1)) {
|
1893
|
variable_set('forum_block_num_new', $forum_block_num_1);
|
1894
|
variable_del('forum_block_num_1');
|
1895
|
}
|
1896
|
}
|
1897
|
|
1898
|
update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
|
1899
|
|
1900
|
}
|
1901
|
|
1902
|
/**
|
1903
|
* Remove throttle columns and variables.
|
1904
|
*/
|
1905
|
function system_update_7005() {
|
1906
|
db_drop_field('blocks', 'throttle');
|
1907
|
db_drop_field('system', 'throttle');
|
1908
|
variable_del('throttle_user');
|
1909
|
variable_del('throttle_anonymous');
|
1910
|
variable_del('throttle_level');
|
1911
|
variable_del('throttle_probability_limiter');
|
1912
|
}
|
1913
|
|
1914
|
/**
|
1915
|
* Convert to new method of storing permissions.
|
1916
|
*/
|
1917
|
function system_update_7007() {
|
1918
|
// Copy the permissions from the old {permission} table to the new {role_permission} table.
|
1919
|
$messages = array();
|
1920
|
$result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid ASC");
|
1921
|
$query = db_insert('role_permission')->fields(array('rid', 'permission'));
|
1922
|
foreach ($result as $role) {
|
1923
|
foreach (array_unique(explode(', ', $role->perm)) as $perm) {
|
1924
|
$query->values(array(
|
1925
|
'rid' => $role->rid,
|
1926
|
'permission' => $perm,
|
1927
|
));
|
1928
|
}
|
1929
|
$messages[] = t('Inserted into {role_permission} the permissions for role ID !id', array('!id' => $role->rid));
|
1930
|
}
|
1931
|
$query->execute();
|
1932
|
db_drop_table('permission');
|
1933
|
|
1934
|
return implode(', ', $messages);
|
1935
|
}
|
1936
|
|
1937
|
/**
|
1938
|
* Rename the variable for primary links.
|
1939
|
*/
|
1940
|
function system_update_7009() {
|
1941
|
$current_primary = variable_get('menu_primary_links_source');
|
1942
|
if (isset($current_primary)) {
|
1943
|
variable_set('menu_main_links_source', $current_primary);
|
1944
|
variable_del('menu_primary_links_source');
|
1945
|
}
|
1946
|
}
|
1947
|
|
1948
|
/**
|
1949
|
* Split the 'bypass node access' permission from 'administer nodes'.
|
1950
|
*/
|
1951
|
function system_update_7011() {
|
1952
|
// Get existing roles that can 'administer nodes'.
|
1953
|
$rids = array();
|
1954
|
$rids = db_query("SELECT rid FROM {role_permission} WHERE permission = :perm", array(':perm' => 'administer nodes'))->fetchCol();
|
1955
|
// None found.
|
1956
|
if (empty($rids)) {
|
1957
|
return;
|
1958
|
}
|
1959
|
$insert = db_insert('role_permission')->fields(array('rid', 'permission'));
|
1960
|
foreach ($rids as $rid) {
|
1961
|
$insert->values(array(
|
1962
|
'rid' => $rid,
|
1963
|
'permission' => 'bypass node access',
|
1964
|
));
|
1965
|
}
|
1966
|
$insert->execute();
|
1967
|
}
|
1968
|
|
1969
|
/**
|
1970
|
* Convert default time zone offset to default time zone name.
|
1971
|
*/
|
1972
|
function system_update_7013() {
|
1973
|
$timezone = NULL;
|
1974
|
$timezones = system_time_zones();
|
1975
|
// If the contributed Date module set a default time zone name, use this
|
1976
|
// setting as the default time zone.
|
1977
|
if (($timezone_name = variable_get('date_default_timezone_name')) && isset($timezones[$timezone_name])) {
|
1978
|
$timezone = $timezone_name;
|
1979
|
}
|
1980
|
// If the contributed Event module has set a default site time zone, look up
|
1981
|
// the time zone name and use it as the default time zone.
|
1982
|
if (!$timezone && ($timezone_id = variable_get('date_default_timezone_id', 0))) {
|
1983
|
try {
|
1984
|
$timezone_name = db_query('SELECT name FROM {event_timezones} WHERE timezone = :timezone_id', array(':timezone_id' => $timezone_id))->fetchField();
|
1985
|
if (($timezone_name = str_replace(' ', '_', $timezone_name)) && isset($timezones[$timezone_name])) {
|
1986
|
$timezone = $timezone_name;
|
1987
|
}
|
1988
|
}
|
1989
|
catch (PDOException $e) {
|
1990
|
// Ignore error if event_timezones table does not exist or unexpected
|
1991
|
// schema found.
|
1992
|
}
|
1993
|
}
|
1994
|
|
1995
|
// Check to see if timezone was overriden in update_prepare_d7_bootstrap().
|
1996
|
$offset = variable_get('date_temporary_timezone');
|
1997
|
// If not, use the default.
|
1998
|
if (!isset($offset)) {
|
1999
|
$offset = variable_get('date_default_timezone', 0);
|
2000
|
}
|
2001
|
|
2002
|
// If the previous default time zone was a non-zero offset, guess the site's
|
2003
|
// intended time zone based on that offset and the server's daylight saving
|
2004
|
// time status.
|
2005
|
if (!$timezone && $offset) {
|
2006
|
$timezone_name = timezone_name_from_abbr('', intval($offset), date('I'));
|
2007
|
if ($timezone_name && isset($timezones[$timezone_name])) {
|
2008
|
$timezone = $timezone_name;
|
2009
|
}
|
2010
|
}
|
2011
|
// Otherwise, the default time zone offset was zero, which is UTC.
|
2012
|
if (!$timezone) {
|
2013
|
$timezone = 'UTC';
|
2014
|
}
|
2015
|
variable_set('date_default_timezone', $timezone);
|
2016
|
drupal_set_message(format_string('The default time zone has been set to %timezone. Check the <a href="@config-url">date and time configuration page</a> to configure it correctly.', array('%timezone' => $timezone, '@config-url' => url('admin/config/regional/settings'))), 'warning');
|
2017
|
// Remove temporary override.
|
2018
|
variable_del('date_temporary_timezone');
|
2019
|
}
|
2020
|
|
2021
|
/**
|
2022
|
* Change the user logout path.
|
2023
|
*/
|
2024
|
function system_update_7015() {
|
2025
|
db_update('menu_links')
|
2026
|
->fields(array('link_path' => 'user/logout'))
|
2027
|
->condition('link_path', 'logout')
|
2028
|
->execute();
|
2029
|
db_update('menu_links')
|
2030
|
->fields(array('router_path' => 'user/logout'))
|
2031
|
->condition('router_path', 'logout')
|
2032
|
->execute();
|
2033
|
|
2034
|
db_update('menu_links')
|
2035
|
->fields(array(
|
2036
|
'menu_name' => 'user-menu',
|
2037
|
'plid' => 0,
|
2038
|
))
|
2039
|
->condition(db_or()
|
2040
|
->condition('link_path', 'user/logout')
|
2041
|
->condition('router_path', 'user/logout')
|
2042
|
)
|
2043
|
->condition('module', 'system')
|
2044
|
->condition('customized', 0)
|
2045
|
->execute();
|
2046
|
}
|
2047
|
|
2048
|
/**
|
2049
|
* Remove custom datatype *_unsigned in PostgreSQL.
|
2050
|
*/
|
2051
|
function system_update_7016() {
|
2052
|
// Only run these queries if the driver used is pgsql.
|
2053
|
if (db_driver() == 'pgsql') {
|
2054
|
$result = db_query("SELECT c.relname AS table, a.attname AS field,
|
2055
|
pg_catalog.format_type(a.atttypid, a.atttypmod) AS type
|
2056
|
FROM pg_catalog.pg_attribute a
|
2057
|
LEFT JOIN pg_class c ON (c.oid = a.attrelid)
|
2058
|
WHERE pg_catalog.pg_table_is_visible(c.oid) AND c.relkind = 'r'
|
2059
|
AND pg_catalog.format_type(a.atttypid, a.atttypmod) LIKE '%unsigned%'");
|
2060
|
foreach ($result as $row) {
|
2061
|
switch ($row->type) {
|
2062
|
case 'smallint_unsigned':
|
2063
|
$datatype = 'int';
|
2064
|
break;
|
2065
|
case 'int_unsigned':
|
2066
|
case 'bigint_unsigned':
|
2067
|
default:
|
2068
|
$datatype = 'bigint';
|
2069
|
break;
|
2070
|
}
|
2071
|
db_query('ALTER TABLE ' . $row->table . ' ALTER COLUMN "' . $row->field . '" TYPE ' . $datatype);
|
2072
|
db_query('ALTER TABLE ' . $row->table . ' ADD CHECK ("' . $row->field . '" >= 0)');
|
2073
|
}
|
2074
|
db_query('DROP DOMAIN IF EXISTS smallint_unsigned');
|
2075
|
db_query('DROP DOMAIN IF EXISTS int_unsigned');
|
2076
|
db_query('DROP DOMAIN IF EXISTS bigint_unsigned');
|
2077
|
}
|
2078
|
}
|
2079
|
|
2080
|
/**
|
2081
|
* Change the theme setting 'toggle_node_info' into a per content type variable.
|
2082
|
*/
|
2083
|
function system_update_7017() {
|
2084
|
// Get the global theme settings.
|
2085
|
$settings = variable_get('theme_settings', array());
|
2086
|
// Get the settings of the default theme.
|
2087
|
$settings = array_merge($settings, variable_get('theme_' . variable_get('theme_default', 'garland') . '_settings', array()));
|
2088
|
|
2089
|
$types = _update_7000_node_get_types();
|
2090
|
foreach ($types as $type) {
|
2091
|
if (isset($settings['toggle_node_info_' . $type->type])) {
|
2092
|
variable_set('node_submitted_' . $type->type, $settings['toggle_node_info_' . $type->type]);
|
2093
|
}
|
2094
|
}
|
2095
|
|
2096
|
// Unset deprecated 'toggle_node_info' theme settings.
|
2097
|
$theme_settings = variable_get('theme_settings', array());
|
2098
|
foreach ($theme_settings as $setting => $value) {
|
2099
|
if (substr($setting, 0, 16) == 'toggle_node_info') {
|
2100
|
unset($theme_settings[$setting]);
|
2101
|
}
|
2102
|
}
|
2103
|
variable_set('theme_settings', $theme_settings);
|
2104
|
}
|
2105
|
|
2106
|
/**
|
2107
|
* Shorten the {system}.type column and modify indexes.
|
2108
|
*/
|
2109
|
function system_update_7018() {
|
2110
|
db_drop_index('system', 'modules');
|
2111
|
db_drop_index('system', 'type_name');
|
2112
|
db_change_field('system', 'type', 'type', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''));
|
2113
|
db_add_index('system', 'type_name', array('type', 'name'));
|
2114
|
}
|
2115
|
|
2116
|
/**
|
2117
|
* Enable field and field_ui modules.
|
2118
|
*/
|
2119
|
function system_update_7020() {
|
2120
|
$module_list = array('field_sql_storage', 'field', 'field_ui');
|
2121
|
module_enable($module_list, FALSE);
|
2122
|
}
|
2123
|
|
2124
|
/**
|
2125
|
* Change the PHP for settings permission.
|
2126
|
*/
|
2127
|
function system_update_7021() {
|
2128
|
db_update('role_permission')
|
2129
|
->fields(array('permission' => 'use PHP for settings'))
|
2130
|
->condition('permission', 'use PHP for block visibility')
|
2131
|
->execute();
|
2132
|
}
|
2133
|
|
2134
|
/**
|
2135
|
* Enable field type modules.
|
2136
|
*/
|
2137
|
function system_update_7027() {
|
2138
|
$module_list = array('text', 'number', 'list', 'options');
|
2139
|
module_enable($module_list, FALSE);
|
2140
|
}
|
2141
|
|
2142
|
/**
|
2143
|
* Add new 'view own unpublished content' permission for authenticated users.
|
2144
|
* Preserves legacy behavior from Drupal 6.x.
|
2145
|
*/
|
2146
|
function system_update_7029() {
|
2147
|
db_insert('role_permission')
|
2148
|
->fields(array(
|
2149
|
'rid' => DRUPAL_AUTHENTICATED_RID,
|
2150
|
'permission' => 'view own unpublished content',
|
2151
|
))
|
2152
|
->execute();
|
2153
|
}
|
2154
|
|
2155
|
/**
|
2156
|
* Alter field hostname to identifier in the {flood} table.
|
2157
|
*/
|
2158
|
function system_update_7032() {
|
2159
|
db_drop_index('flood', 'allow');
|
2160
|
db_change_field('flood', 'hostname', 'identifier', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
|
2161
|
db_add_index('flood', 'allow', array('event', 'identifier', 'timestamp'));
|
2162
|
}
|
2163
|
|
2164
|
/**
|
2165
|
* Move CACHE_AGGRESSIVE to CACHE_NORMAL.
|
2166
|
*/
|
2167
|
function system_update_7033() {
|
2168
|
if (variable_get('cache') == 2) {
|
2169
|
variable_set('cache', 1);
|
2170
|
return t('Aggressive caching was disabled and replaced with normal caching. Read the page caching section in default.settings.php for more information on how to enable similar functionality.');
|
2171
|
}
|
2172
|
}
|
2173
|
|
2174
|
/**
|
2175
|
* Migrate the file path settings and create the new {file_managed} table.
|
2176
|
*/
|
2177
|
function system_update_7034() {
|
2178
|
$files_directory = variable_get('file_directory_path', NULL);
|
2179
|
if (variable_get('file_downloads', 1) == 1) {
|
2180
|
// Our default is public, so we don't need to set anything.
|
2181
|
if (!empty($files_directory)) {
|
2182
|
variable_set('file_public_path', $files_directory);
|
2183
|
}
|
2184
|
}
|
2185
|
elseif (variable_get('file_downloads', 1) == 2) {
|
2186
|
variable_set('file_default_scheme', 'private');
|
2187
|
if (!empty($files_directory)) {
|
2188
|
variable_set('file_private_path', $files_directory);
|
2189
|
}
|
2190
|
}
|
2191
|
variable_del('file_downloads');
|
2192
|
|
2193
|
$schema['file_managed'] = array(
|
2194
|
'description' => 'Stores information for uploaded files.',
|
2195
|
'fields' => array(
|
2196
|
'fid' => array(
|
2197
|
'description' => 'File ID.',
|
2198
|
'type' => 'serial',
|
2199
|
'unsigned' => TRUE,
|
2200
|
'not null' => TRUE,
|
2201
|
),
|
2202
|
'uid' => array(
|
2203
|
'description' => 'The {user}.uid of the user who is associated with the file.',
|
2204
|
'type' => 'int',
|
2205
|
'unsigned' => TRUE,
|
2206
|
'not null' => TRUE,
|
2207
|
'default' => 0,
|
2208
|
),
|
2209
|
'filename' => array(
|
2210
|
'description' => 'Name of the file with no path components. This may differ from the basename of the filepath if the file is renamed to avoid overwriting an existing file.',
|
2211
|
'type' => 'varchar',
|
2212
|
'length' => 255,
|
2213
|
'not null' => TRUE,
|
2214
|
'default' => '',
|
2215
|
'binary' => TRUE,
|
2216
|
),
|
2217
|
'uri' => array(
|
2218
|
'description' => 'URI of file.',
|
2219
|
'type' => 'varchar',
|
2220
|
'length' => 255,
|
2221
|
'not null' => TRUE,
|
2222
|
'default' => '',
|
2223
|
'binary' => TRUE,
|
2224
|
),
|
2225
|
'filemime' => array(
|
2226
|
'description' => "The file's MIME type.",
|
2227
|
'type' => 'varchar',
|
2228
|
'length' => 255,
|
2229
|
'not null' => TRUE,
|
2230
|
'default' => '',
|
2231
|
),
|
2232
|
'filesize' => array(
|
2233
|
'description' => 'The size of the file in bytes.',
|
2234
|
'type' => 'int',
|
2235
|
'unsigned' => TRUE,
|
2236
|
'not null' => TRUE,
|
2237
|
'default' => 0,
|
2238
|
),
|
2239
|
'status' => array(
|
2240
|
'description' => 'A field indicating the status of the file. Two status are defined in core: temporary (0) and permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.',
|
2241
|
'type' => 'int',
|
2242
|
'not null' => TRUE,
|
2243
|
'default' => 0,
|
2244
|
'size' => 'tiny',
|
2245
|
),
|
2246
|
'timestamp' => array(
|
2247
|
'description' => 'UNIX timestamp for when the file was added.',
|
2248
|
'type' => 'int',
|
2249
|
'unsigned' => TRUE,
|
2250
|
'not null' => TRUE,
|
2251
|
'default' => 0,
|
2252
|
),
|
2253
|
),
|
2254
|
'indexes' => array(
|
2255
|
'uid' => array('uid'),
|
2256
|
'status' => array('status'),
|
2257
|
'timestamp' => array('timestamp'),
|
2258
|
),
|
2259
|
'unique keys' => array(
|
2260
|
'uri' => array('uri'),
|
2261
|
),
|
2262
|
'primary key' => array('fid'),
|
2263
|
);
|
2264
|
|
2265
|
db_create_table('file_managed', $schema['file_managed']);
|
2266
|
}
|
2267
|
|
2268
|
/**
|
2269
|
* Split the 'access site in maintenance mode' permission from 'administer site configuration'.
|
2270
|
*/
|
2271
|
function system_update_7036() {
|
2272
|
// Get existing roles that can 'administer site configuration'.
|
2273
|
$rids = db_query("SELECT rid FROM {role_permission} WHERE permission = :perm", array(':perm' => 'administer site configuration'))->fetchCol();
|
2274
|
// None found.
|
2275
|
if (empty($rids)) {
|
2276
|
return;
|
2277
|
}
|
2278
|
$insert = db_insert('role_permission')->fields(array('rid', 'permission'));
|
2279
|
foreach ($rids as $rid) {
|
2280
|
$insert->values(array(
|
2281
|
'rid' => $rid,
|
2282
|
'permission' => 'access site in maintenance mode',
|
2283
|
));
|
2284
|
}
|
2285
|
$insert->execute();
|
2286
|
}
|
2287
|
|
2288
|
/**
|
2289
|
* Upgrade the {url_alias} table and create a cache bin for path aliases.
|
2290
|
*/
|
2291
|
function system_update_7042() {
|
2292
|
// update_fix_d7_requirements() adds 'fake' source and alias columns to
|
2293
|
// allow bootstrap to run without fatal errors. Remove those columns now
|
2294
|
// so that we can rename properly.
|
2295
|
db_drop_field('url_alias', 'source');
|
2296
|
db_drop_field('url_alias', 'alias');
|
2297
|
|
2298
|
// Drop indexes.
|
2299
|
db_drop_index('url_alias', 'src_language_pid');
|
2300
|
db_drop_unique_key('url_alias', 'dst_language_pid');
|
2301
|
// Rename the fields, and increase their length to 255 characters.
|
2302
|
db_change_field('url_alias', 'src', 'source', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
|
2303
|
db_change_field('url_alias', 'dst', 'alias', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
|
2304
|
// Add indexes back. We replace the unique key with an index since it never
|
2305
|
// provided any meaningful unique constraint ('pid' is a primary key).
|
2306
|
db_add_index('url_alias', 'source_language_pid', array('source', 'language', 'pid'));
|
2307
|
db_add_index('url_alias', 'alias_language_pid', array('alias', 'language', 'pid'));
|
2308
|
|
2309
|
// Now that the URL aliases are correct, we can rebuild the whitelist.
|
2310
|
drupal_path_alias_whitelist_rebuild();
|
2311
|
}
|
2312
|
|
2313
|
/**
|
2314
|
* Drop the actions_aid table.
|
2315
|
*/
|
2316
|
function system_update_7044() {
|
2317
|
// The current value of the increment has been taken into account when
|
2318
|
// creating the sequences table in update_fix_d7_requirements().
|
2319
|
db_drop_table('actions_aid');
|
2320
|
}
|
2321
|
|
2322
|
/**
|
2323
|
* Add expiration field to the {flood} table.
|
2324
|
*/
|
2325
|
function system_update_7045() {
|
2326
|
db_add_field('flood', 'expiration', array('description' => 'Expiration timestamp. Expired events are purged on cron run.', 'type' => 'int', 'not null' => TRUE, 'default' => 0));
|
2327
|
db_add_index('flood', 'purge', array('expiration'));
|
2328
|
}
|
2329
|
|
2330
|
/**
|
2331
|
* Switch from the Minnelli theme if it is the default or admin theme.
|
2332
|
*/
|
2333
|
function system_update_7046() {
|
2334
|
if (variable_get('theme_default') == 'minnelli' || variable_get('admin_theme') == 'minnelli') {
|
2335
|
// Make sure Garland is enabled.
|
2336
|
db_update('system')
|
2337
|
->fields(array('status' => 1))
|
2338
|
->condition('type', 'theme')
|
2339
|
->condition('name', 'garland')
|
2340
|
->execute();
|
2341
|
if (variable_get('theme_default') != 'garland') {
|
2342
|
// If the default theme isn't Garland, transfer all of Minnelli's old
|
2343
|
// settings to Garland.
|
2344
|
$settings = variable_get('theme_minnelli_settings', array());
|
2345
|
// Set the theme setting width to "fixed" to match Minnelli's old layout.
|
2346
|
$settings['garland_width'] = 'fixed';
|
2347
|
variable_set('theme_garland_settings', $settings);
|
2348
|
// Remove Garland's color files since they won't match Minnelli's.
|
2349
|
foreach (variable_get('color_garland_files', array()) as $file) {
|
2350
|
@drupal_unlink($file);
|
2351
|
}
|
2352
|
if (isset($file) && $file = dirname($file)) {
|
2353
|
@drupal_rmdir($file);
|
2354
|
}
|
2355
|
variable_del('color_garland_palette');
|
2356
|
variable_del('color_garland_stylesheets');
|
2357
|
variable_del('color_garland_logo');
|
2358
|
variable_del('color_garland_files');
|
2359
|
variable_del('color_garland_screenshot');
|
2360
|
}
|
2361
|
if (variable_get('theme_default') == 'minnelli') {
|
2362
|
variable_set('theme_default', 'garland');
|
2363
|
}
|
2364
|
if (variable_get('admin_theme') == 'minnelli') {
|
2365
|
variable_set('admin_theme', 'garland');
|
2366
|
}
|
2367
|
}
|
2368
|
}
|
2369
|
|
2370
|
/**
|
2371
|
* Normalize the front page path variable.
|
2372
|
*/
|
2373
|
function system_update_7047() {
|
2374
|
variable_set('site_frontpage', drupal_get_normal_path(variable_get('site_frontpage', 'node')));
|
2375
|
}
|
2376
|
|
2377
|
/**
|
2378
|
* Convert path languages from the empty string to LANGUAGE_NONE.
|
2379
|
*/
|
2380
|
function system_update_7048() {
|
2381
|
db_update('url_alias')
|
2382
|
->fields(array('language' => LANGUAGE_NONE))
|
2383
|
->condition('language', '')
|
2384
|
->execute();
|
2385
|
}
|
2386
|
|
2387
|
/**
|
2388
|
* Rename 'Default' profile to 'Standard.'
|
2389
|
*/
|
2390
|
function system_update_7049() {
|
2391
|
if (variable_get('install_profile', 'standard') == 'default') {
|
2392
|
variable_set('install_profile', 'standard');
|
2393
|
}
|
2394
|
}
|
2395
|
|
2396
|
/**
|
2397
|
* Change {batch}.id column from serial to regular int.
|
2398
|
*/
|
2399
|
function system_update_7050() {
|
2400
|
db_change_field('batch', 'bid', 'bid', array('description' => 'Primary Key: Unique batch ID.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
|
2401
|
}
|
2402
|
|
2403
|
/**
|
2404
|
* make the IP field IPv6 compatible
|
2405
|
*/
|
2406
|
function system_update_7051() {
|
2407
|
db_change_field('blocked_ips', 'ip', 'ip', array('description' => 'IP address', 'type' => 'varchar', 'length' => 40, 'not null' => TRUE, 'default' => ''));
|
2408
|
}
|
2409
|
|
2410
|
/**
|
2411
|
* Rename file to include_file in {menu_router} table.
|
2412
|
*/
|
2413
|
function system_update_7052() {
|
2414
|
db_change_field('menu_router', 'file', 'include_file', array('type' => 'text', 'size' => 'medium'));
|
2415
|
}
|
2416
|
|
2417
|
/**
|
2418
|
* Upgrade standard blocks and menus.
|
2419
|
*/
|
2420
|
function system_update_7053() {
|
2421
|
if (db_table_exists('menu_custom')) {
|
2422
|
// Create the same menus as in menu_install().
|
2423
|
db_insert('menu_custom')
|
2424
|
->fields(array('menu_name' => 'user-menu', 'title' => 'User Menu', 'description' => "The <em>User</em> menu contains links related to the user's account, as well as the 'Log out' link."))
|
2425
|
->execute();
|
2426
|
|
2427
|
db_insert('menu_custom')
|
2428
|
->fields(array('menu_name' => 'management', 'title' => 'Management', 'description' => "The <em>Management</em> menu contains links for administrative tasks."))
|
2429
|
->execute();
|
2430
|
}
|
2431
|
|
2432
|
block_flush_caches();
|
2433
|
|
2434
|
// Show the new menu blocks along the navigation block.
|
2435
|
$blocks = db_query("SELECT theme, status, region, weight, visibility, pages FROM {block} WHERE module = 'system' AND delta = 'navigation'");
|
2436
|
$deltas = db_or()
|
2437
|
->condition('delta', 'user-menu')
|
2438
|
->condition('delta', 'management');
|
2439
|
|
2440
|
foreach ($blocks as $block) {
|
2441
|
db_update('block')
|
2442
|
->fields(array(
|
2443
|
'status' => $block->status,
|
2444
|
'region' => $block->region,
|
2445
|
'weight' => $block->weight,
|
2446
|
'visibility' => $block->visibility,
|
2447
|
'pages' => $block->pages,
|
2448
|
))
|
2449
|
->condition('theme', $block->theme)
|
2450
|
->condition('module', 'system')
|
2451
|
->condition($deltas)
|
2452
|
->execute();
|
2453
|
}
|
2454
|
}
|
2455
|
|
2456
|
/**
|
2457
|
* Remove {cache_*}.headers columns.
|
2458
|
*/
|
2459
|
function system_update_7054() {
|
2460
|
// Update: update_fix_d7_requirements() installs this version for cache_path
|
2461
|
// already, so we don't include it in this particular update. It should be
|
2462
|
// included in later updates though.
|
2463
|
$cache_tables = array(
|
2464
|
'cache' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.',
|
2465
|
'cache_form' => 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.',
|
2466
|
'cache_page' => 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.',
|
2467
|
'cache_menu' => 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.',
|
2468
|
);
|
2469
|
$schema = system_schema_cache_7054();
|
2470
|
foreach ($cache_tables as $table => $description) {
|
2471
|
$schema['description'] = $description;
|
2472
|
db_drop_table($table);
|
2473
|
db_create_table($table, $schema);
|
2474
|
}
|
2475
|
}
|
2476
|
|
2477
|
/**
|
2478
|
* Converts fields that store serialized variables from text to blob.
|
2479
|
*/
|
2480
|
function system_update_7055() {
|
2481
|
$spec = array(
|
2482
|
'description' => 'The value of the variable.',
|
2483
|
'type' => 'blob',
|
2484
|
'not null' => TRUE,
|
2485
|
'size' => 'big',
|
2486
|
'translatable' => TRUE,
|
2487
|
);
|
2488
|
db_change_field('variable', 'value', 'value', $spec);
|
2489
|
|
2490
|
$spec = array(
|
2491
|
'description' => 'Parameters to be passed to the callback function.',
|
2492
|
'type' => 'blob',
|
2493
|
'not null' => TRUE,
|
2494
|
'size' => 'big',
|
2495
|
);
|
2496
|
db_change_field('actions', 'parameters', 'parameters', $spec);
|
2497
|
|
2498
|
$spec = array(
|
2499
|
'description' => 'A serialized array containing the processing data for the batch.',
|
2500
|
'type' => 'blob',
|
2501
|
'not null' => FALSE,
|
2502
|
'size' => 'big',
|
2503
|
);
|
2504
|
db_change_field('batch', 'batch', 'batch', $spec);
|
2505
|
|
2506
|
$spec = array(
|
2507
|
'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.',
|
2508
|
'type' => 'blob',
|
2509
|
'not null' => TRUE,
|
2510
|
);
|
2511
|
db_change_field('menu_router', 'load_functions', 'load_functions', $spec);
|
2512
|
|
2513
|
$spec = array(
|
2514
|
'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.',
|
2515
|
'type' => 'blob',
|
2516
|
'not null' => TRUE,
|
2517
|
);
|
2518
|
db_change_field('menu_router', 'to_arg_functions', 'to_arg_functions', $spec);
|
2519
|
|
2520
|
$spec = array(
|
2521
|
'description' => 'A serialized array of arguments for the access callback.',
|
2522
|
'type' => 'blob',
|
2523
|
'not null' => FALSE,
|
2524
|
);
|
2525
|
db_change_field('menu_router', 'access_arguments', 'access_arguments', $spec);
|
2526
|
|
2527
|
$spec = array(
|
2528
|
'description' => 'A serialized array of arguments for the page callback.',
|
2529
|
'type' => 'blob',
|
2530
|
'not null' => FALSE,
|
2531
|
);
|
2532
|
db_change_field('menu_router', 'page_arguments', 'page_arguments', $spec);
|
2533
|
|
2534
|
$spec = array(
|
2535
|
'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.',
|
2536
|
'type' => 'blob',
|
2537
|
'not null' => FALSE,
|
2538
|
'translatable' => TRUE,
|
2539
|
);
|
2540
|
db_change_field('menu_links', 'options', 'options', $spec);
|
2541
|
|
2542
|
$spec = array(
|
2543
|
'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
|
2544
|
'type' => 'blob',
|
2545
|
'not null' => FALSE,
|
2546
|
'size' => 'big',
|
2547
|
);
|
2548
|
db_change_field('sessions', 'session', 'session', $spec);
|
2549
|
|
2550
|
$spec = array(
|
2551
|
'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, and php.",
|
2552
|
'type' => 'blob',
|
2553
|
'not null' => FALSE,
|
2554
|
);
|
2555
|
db_change_field('system', 'info', 'info', $spec);
|
2556
|
}
|
2557
|
|
2558
|
/**
|
2559
|
* Increase the size of session-ids.
|
2560
|
*/
|
2561
|
function system_update_7057() {
|
2562
|
$spec = array(
|
2563
|
'description' => "A session ID. The value is generated by PHP's Session API.",
|
2564
|
'type' => 'varchar',
|
2565
|
'length' => 128,
|
2566
|
'not null' => TRUE,
|
2567
|
'default' => '',
|
2568
|
);
|
2569
|
db_change_field('sessions', 'sid', 'sid', $spec);
|
2570
|
}
|
2571
|
|
2572
|
/**
|
2573
|
* Remove cron semaphore variable.
|
2574
|
*/
|
2575
|
function system_update_7058() {
|
2576
|
variable_del('cron_semaphore');
|
2577
|
}
|
2578
|
|
2579
|
/**
|
2580
|
* Create the {file_usage} table.
|
2581
|
*/
|
2582
|
function system_update_7059() {
|
2583
|
$spec = array(
|
2584
|
'description' => 'Track where a file is used.',
|
2585
|
'fields' => array(
|
2586
|
'fid' => array(
|
2587
|
'description' => 'File ID.',
|
2588
|
'type' => 'int',
|
2589
|
'unsigned' => TRUE,
|
2590
|
'not null' => TRUE,
|
2591
|
),
|
2592
|
'module' => array(
|
2593
|
'description' => 'The name of the module that is using the file.',
|
2594
|
'type' => 'varchar',
|
2595
|
'length' => 255,
|
2596
|
'not null' => TRUE,
|
2597
|
'default' => '',
|
2598
|
),
|
2599
|
'type' => array(
|
2600
|
'description' => 'The name of the object type in which the file is used.',
|
2601
|
'type' => 'varchar',
|
2602
|
'length' => 64,
|
2603
|
'not null' => TRUE,
|
2604
|
'default' => '',
|
2605
|
),
|
2606
|
'id' => array(
|
2607
|
'description' => 'The primary key of the object using the file.',
|
2608
|
'type' => 'int',
|
2609
|
'unsigned' => TRUE,
|
2610
|
'not null' => TRUE,
|
2611
|
'default' => 0,
|
2612
|
),
|
2613
|
'count' => array(
|
2614
|
'description' => 'The number of times this file is used by this object.',
|
2615
|
'type' => 'int',
|
2616
|
'unsigned' => TRUE,
|
2617
|
'not null' => TRUE,
|
2618
|
'default' => 0,
|
2619
|
),
|
2620
|
),
|
2621
|
'primary key' => array('fid', 'type', 'id', 'module'),
|
2622
|
'indexes' => array(
|
2623
|
'type_id' => array('type', 'id'),
|
2624
|
'fid_count' => array('fid', 'count'),
|
2625
|
'fid_module' => array('fid', 'module'),
|
2626
|
),
|
2627
|
);
|
2628
|
db_create_table('file_usage', $spec);
|
2629
|
}
|
2630
|
|
2631
|
/**
|
2632
|
* Create fields in preparation for migrating upload.module to file.module.
|
2633
|
*/
|
2634
|
function system_update_7060() {
|
2635
|
if (!db_table_exists('upload')) {
|
2636
|
return;
|
2637
|
}
|
2638
|
|
2639
|
if (!db_query_range('SELECT 1 FROM {upload}', 0, 1)->fetchField()) {
|
2640
|
// There is nothing to migrate. Delete variables and the empty table. There
|
2641
|
// is no need to create fields that are not going to be used.
|
2642
|
foreach (_update_7000_node_get_types() as $node_type) {
|
2643
|
variable_del('upload_' . $node_type->type);
|
2644
|
}
|
2645
|
db_drop_table('upload');
|
2646
|
return;
|
2647
|
}
|
2648
|
|
2649
|
// Check which node types have upload.module attachments enabled.
|
2650
|
$context['types'] = array();
|
2651
|
foreach (_update_7000_node_get_types() as $node_type) {
|
2652
|
if (variable_get('upload_' . $node_type->type, 0)) {
|
2653
|
$context['types'][$node_type->type] = $node_type->type;
|
2654
|
}
|
2655
|
}
|
2656
|
|
2657
|
// The {upload} table will be deleted when this update is complete so we
|
2658
|
// want to be careful to migrate all the data, even for node types that
|
2659
|
// may have had attachments disabled after files were uploaded. Look for
|
2660
|
// any other node types referenced by the upload records and add those to
|
2661
|
// the list. The admin can always remove the field later.
|
2662
|
$results = db_query('SELECT DISTINCT type FROM {node} n INNER JOIN {node_revision} nr ON n.nid = nr.nid INNER JOIN {upload} u ON nr.vid = u.vid');
|
2663
|
foreach ($results as $row) {
|
2664
|
if (!isset($context['types'][$row->type])) {
|
2665
|
drupal_set_message(t('The content type %rowtype had uploads disabled but contained uploaded file data. Uploads have been re-enabled to migrate the existing data. You may delete the "File attachments" field in the %rowtype type if this data is not necessary.', array('%rowtype' => $row->type)));
|
2666
|
$context['types'][$row->type] = $row->type;
|
2667
|
}
|
2668
|
}
|
2669
|
|
2670
|
// Create a single "upload" field on all the content types that have uploads
|
2671
|
// enabled, then add an instance to each enabled type.
|
2672
|
if (count($context['types']) > 0) {
|
2673
|
module_enable(array('file'));
|
2674
|
$field = array(
|
2675
|
'field_name' => 'upload',
|
2676
|
'type' => 'file',
|
2677
|
'module' => 'file',
|
2678
|
'locked' => FALSE,
|
2679
|
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
|
2680
|
'translatable' => FALSE,
|
2681
|
'settings' => array(
|
2682
|
'display_field' => 1,
|
2683
|
'display_default' => variable_get('upload_list_default', 1),
|
2684
|
'uri_scheme' => file_default_scheme(),
|
2685
|
'default_file' => 0,
|
2686
|
),
|
2687
|
);
|
2688
|
|
2689
|
$upload_size = variable_get('upload_uploadsize_default', 1);
|
2690
|
$instance = array(
|
2691
|
'field_name' => 'upload',
|
2692
|
'entity_type' => 'node',
|
2693
|
'bundle' => NULL,
|
2694
|
'label' => 'File attachments',
|
2695
|
'required' => 0,
|
2696
|
'description' => '',
|
2697
|
'widget' => array(
|
2698
|
'weight' => '1',
|
2699
|
'settings' => array(
|
2700
|
'progress_indicator' => 'throbber',
|
2701
|
),
|
2702
|
'type' => 'file_generic',
|
2703
|
),
|
2704
|
'settings' => array(
|
2705
|
'max_filesize' => $upload_size ? ($upload_size . ' MB') : '',
|
2706
|
'file_extensions' => variable_get('upload_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'),
|
2707
|
'file_directory' => '',
|
2708
|
'description_field' => 1,
|
2709
|
),
|
2710
|
'display' => array(
|
2711
|
'default' => array(
|
2712
|
'label' => 'hidden',
|
2713
|
'type' => 'file_table',
|
2714
|
'settings' => array(),
|
2715
|
'weight' => 0,
|
2716
|
'module' => 'file',
|
2717
|
),
|
2718
|
'full' => array(
|
2719
|
'label' => 'hidden',
|
2720
|
'type' => 'file_table',
|
2721
|
'settings' => array(),
|
2722
|
'weight' => 0,
|
2723
|
'module' => 'file',
|
2724
|
),
|
2725
|
'teaser' => array(
|
2726
|
'label' => 'hidden',
|
2727
|
'type' => 'hidden',
|
2728
|
'settings' => array(),
|
2729
|
'weight' => 0,
|
2730
|
'module' => NULL,
|
2731
|
),
|
2732
|
'rss' => array(
|
2733
|
'label' => 'hidden',
|
2734
|
'type' => 'file_table',
|
2735
|
'settings' => array(),
|
2736
|
'weight' => 0,
|
2737
|
'module' => 'file',
|
2738
|
),
|
2739
|
),
|
2740
|
);
|
2741
|
|
2742
|
// Create the field.
|
2743
|
_update_7000_field_create_field($field);
|
2744
|
|
2745
|
// Create the instances.
|
2746
|
foreach ($context['types'] as $bundle) {
|
2747
|
$instance['bundle'] = $bundle;
|
2748
|
_update_7000_field_create_instance($field, $instance);
|
2749
|
// Now that the instance is created, we can safely delete any legacy
|
2750
|
// node type information.
|
2751
|
variable_del('upload_' . $bundle);
|
2752
|
}
|
2753
|
}
|
2754
|
else {
|
2755
|
// No uploads or content types with uploads enabled.
|
2756
|
db_drop_table('upload');
|
2757
|
}
|
2758
|
}
|
2759
|
|
2760
|
/**
|
2761
|
* Migrate upload.module data to the newly created file field.
|
2762
|
*/
|
2763
|
function system_update_7061(&$sandbox) {
|
2764
|
if (!db_table_exists('upload')) {
|
2765
|
return;
|
2766
|
}
|
2767
|
|
2768
|
if (!isset($sandbox['progress'])) {
|
2769
|
// Delete stale rows from {upload} where the fid is not in the {files} table.
|
2770
|
db_delete('upload')
|
2771
|
->notExists(
|
2772
|
db_select('files', 'f')
|
2773
|
->fields('f', array('fid'))
|
2774
|
->where('f.fid = {upload}.fid')
|
2775
|
)
|
2776
|
->execute();
|
2777
|
|
2778
|
// Delete stale rows from {upload} where the vid is not in the
|
2779
|
// {node_revision} table. The table has already been renamed in
|
2780
|
// node_update_7001().
|
2781
|
db_delete('upload')
|
2782
|
->notExists(
|
2783
|
db_select('node_revision', 'nr')
|
2784
|
->fields('nr', array('vid'))
|
2785
|
->where('nr.vid = {upload}.vid')
|
2786
|
)
|
2787
|
->execute();
|
2788
|
|
2789
|
// Retrieve a list of node revisions that have uploaded files attached.
|
2790
|
// DISTINCT queries are expensive, especially when paged, so we store the
|
2791
|
// data in its own table for the duration of the update.
|
2792
|
if (!db_table_exists('system_update_7061')) {
|
2793
|
$table = array(
|
2794
|
'description' => t('Stores temporary data for system_update_7061.'),
|
2795
|
'fields' => array('vid' => array('type' => 'int')),
|
2796
|
'primary key' => array('vid'),
|
2797
|
);
|
2798
|
db_create_table('system_update_7061', $table);
|
2799
|
}
|
2800
|
$query = db_select('upload', 'u');
|
2801
|
$query->distinct();
|
2802
|
$query->addField('u','vid');
|
2803
|
db_insert('system_update_7061')
|
2804
|
->from($query)
|
2805
|
->execute();
|
2806
|
|
2807
|
// Retrieve a list of duplicate files with the same filepath. Only the
|
2808
|
// most-recently uploaded of these will be moved to the new {file_managed}
|
2809
|
// table (and all references will be updated to point to it), since
|
2810
|
// duplicate file URIs are not allowed in Drupal 7.
|
2811
|
// Since the Drupal 6 to 7 upgrade path leaves the {files} table behind
|
2812
|
// after it's done, custom or contributed modules which need to migrate
|
2813
|
// file references of their own can use a similar query to determine the
|
2814
|
// file IDs that duplicate filepaths were mapped to.
|
2815
|
$sandbox['duplicate_filepath_fids_to_use'] = db_query("SELECT filepath, MAX(fid) FROM {files} GROUP BY filepath HAVING COUNT(*) > 1")->fetchAllKeyed();
|
2816
|
|
2817
|
// Initialize batch update information.
|
2818
|
$sandbox['progress'] = 0;
|
2819
|
$sandbox['last_vid_processed'] = -1;
|
2820
|
$sandbox['max'] = db_query("SELECT COUNT(*) FROM {system_update_7061}")->fetchField();
|
2821
|
}
|
2822
|
|
2823
|
// Determine vids for this batch.
|
2824
|
// Process all files attached to a given revision during the same batch.
|
2825
|
$limit = variable_get('upload_update_batch_size', 100);
|
2826
|
$vids = db_query_range('SELECT vid FROM {system_update_7061} WHERE vid > :lastvid ORDER BY vid', 0, $limit, array(':lastvid' => $sandbox['last_vid_processed']))
|
2827
|
->fetchCol();
|
2828
|
|
2829
|
// Retrieve information on all the files attached to these revisions.
|
2830
|
if (!empty($vids)) {
|
2831
|
$node_revisions = array();
|
2832
|
$result = db_query('SELECT u.fid, u.vid, u.list, u.description, n.nid, n.type, u.weight FROM {upload} u INNER JOIN {node_revision} nr ON u.vid = nr.vid INNER JOIN {node} n ON n.nid = nr.nid WHERE u.vid IN (:vids) ORDER BY u.vid, u.weight, u.fid', array(':vids' => $vids));
|
2833
|
foreach ($result as $record) {
|
2834
|
// For each uploaded file, retrieve the corresponding data from the old
|
2835
|
// files table (since upload doesn't know about the new entry in the
|
2836
|
// file_managed table).
|
2837
|
$file = db_select('files', 'f')
|
2838
|
->fields('f', array('fid', 'uid', 'filename', 'filepath', 'filemime', 'filesize', 'status', 'timestamp'))
|
2839
|
->condition('f.fid', $record->fid)
|
2840
|
->execute()
|
2841
|
->fetchAssoc();
|
2842
|
if (!$file) {
|
2843
|
continue;
|
2844
|
}
|
2845
|
|
2846
|
// If this file has a duplicate filepath, replace it with the
|
2847
|
// most-recently uploaded file that has the same filepath.
|
2848
|
if (isset($sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) && $record->fid != $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) {
|
2849
|
$file = db_select('files', 'f')
|
2850
|
->fields('f', array('fid', 'uid', 'filename', 'filepath', 'filemime', 'filesize', 'status', 'timestamp'))
|
2851
|
->condition('f.fid', $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']])
|
2852
|
->execute()
|
2853
|
->fetchAssoc();
|
2854
|
}
|
2855
|
|
2856
|
// Add in the file information from the upload table.
|
2857
|
$file['description'] = $record->description;
|
2858
|
$file['display'] = $record->list;
|
2859
|
|
2860
|
// Create one record for each revision that contains all the uploaded
|
2861
|
// files.
|
2862
|
$node_revisions[$record->vid]['nid'] = $record->nid;
|
2863
|
$node_revisions[$record->vid]['vid'] = $record->vid;
|
2864
|
$node_revisions[$record->vid]['type'] = $record->type;
|
2865
|
$node_revisions[$record->vid]['file'][LANGUAGE_NONE][] = $file;
|
2866
|
}
|
2867
|
|
2868
|
// Now that we know which files belong to which revisions, update the
|
2869
|
// files'// database entries, and save a reference to each file in the
|
2870
|
// upload field on their node revisions.
|
2871
|
$basename = variable_get('file_directory_path', conf_path() . '/files');
|
2872
|
$scheme = file_default_scheme() . '://';
|
2873
|
foreach ($node_revisions as $vid => $revision) {
|
2874
|
foreach ($revision['file'][LANGUAGE_NONE] as $delta => $file) {
|
2875
|
// We will convert filepaths to URI using the default scheme
|
2876
|
// and stripping off the existing file directory path.
|
2877
|
$file['uri'] = $scheme . preg_replace('!^' . preg_quote($basename) . '!', '', $file['filepath']);
|
2878
|
// Normalize the URI but don't call file_stream_wrapper_uri_normalize()
|
2879
|
// directly, since that is a higher-level API function which invokes
|
2880
|
// hooks while validating the scheme, and those will not work during
|
2881
|
// the upgrade. Instead, use a simpler version that just assumes the
|
2882
|
// scheme from above is already valid.
|
2883
|
if (($file_uri_scheme = file_uri_scheme($file['uri'])) && ($file_uri_target = file_uri_target($file['uri']))) {
|
2884
|
$file['uri'] = $file_uri_scheme . '://' . $file_uri_target;
|
2885
|
}
|
2886
|
unset($file['filepath']);
|
2887
|
// Insert into the file_managed table.
|
2888
|
// Each fid should only be stored once in file_managed.
|
2889
|
db_merge('file_managed')
|
2890
|
->key(array(
|
2891
|
'fid' => $file['fid'],
|
2892
|
))
|
2893
|
->fields(array(
|
2894
|
'uid' => $file['uid'],
|
2895
|
'filename' => $file['filename'],
|
2896
|
'uri' => $file['uri'],
|
2897
|
'filemime' => $file['filemime'],
|
2898
|
'filesize' => $file['filesize'],
|
2899
|
'status' => $file['status'],
|
2900
|
'timestamp' => $file['timestamp'],
|
2901
|
))
|
2902
|
->execute();
|
2903
|
|
2904
|
// Add the usage entry for the file.
|
2905
|
$file = (object) $file;
|
2906
|
file_usage_add($file, 'file', 'node', $revision['nid']);
|
2907
|
|
2908
|
// Update the node revision's upload file field with the file data.
|
2909
|
$revision['file'][LANGUAGE_NONE][$delta] = array('fid' => $file->fid, 'display' => $file->display, 'description' => $file->description);
|
2910
|
}
|
2911
|
|
2912
|
// Write the revision's upload field data into the field_upload tables.
|
2913
|
$node = (object) $revision;
|
2914
|
_update_7000_field_sql_storage_write('node', $node->type, $node->nid, $node->vid, 'upload', $node->file);
|
2915
|
|
2916
|
// Update our progress information for the batch update.
|
2917
|
$sandbox['progress']++;
|
2918
|
$sandbox['last_vid_processed'] = $vid;
|
2919
|
}
|
2920
|
}
|
2921
|
|
2922
|
// If less than limit node revisions were processed, the update process is
|
2923
|
// finished.
|
2924
|
if (count($vids) < $limit) {
|
2925
|
$finished = TRUE;
|
2926
|
}
|
2927
|
|
2928
|
// If there's no max value then there's nothing to update and we're finished.
|
2929
|
if (empty($sandbox['max']) || isset($finished)) {
|
2930
|
db_drop_table('upload');
|
2931
|
db_drop_table('system_update_7061');
|
2932
|
return t('Upload module has been migrated to File module.');
|
2933
|
}
|
2934
|
else {
|
2935
|
// Indicate our current progress to the batch update system.
|
2936
|
$sandbox['#finished'] = $sandbox['progress'] / $sandbox['max'];
|
2937
|
}
|
2938
|
}
|
2939
|
|
2940
|
/**
|
2941
|
* Replace 'system_list' index with 'bootstrap' index on {system}.
|
2942
|
*/
|
2943
|
function system_update_7062() {
|
2944
|
db_drop_index('system', 'bootstrap');
|
2945
|
db_drop_index('system', 'system_list');
|
2946
|
db_add_index('system', 'system_list', array('status', 'bootstrap', 'type', 'weight', 'name'));
|
2947
|
}
|
2948
|
|
2949
|
/**
|
2950
|
* Delete {menu_links} records for 'type' => MENU_CALLBACK which would not appear in a fresh install.
|
2951
|
*/
|
2952
|
function system_update_7063() {
|
2953
|
// For router items where 'type' => MENU_CALLBACK, {menu_router}.type is
|
2954
|
// stored as 4 in Drupal 6, and 0 in Drupal 7. Fortunately Drupal 7 doesn't
|
2955
|
// store any types as 4, so delete both.
|
2956
|
$result = db_query('SELECT ml.mlid FROM {menu_links} ml INNER JOIN {menu_router} mr ON ml.router_path = mr.path WHERE ml.module = :system AND ml.customized = 0 AND mr.type IN(:callbacks)', array(':callbacks' => array(0, 4), ':system' => 'system'));
|
2957
|
foreach ($result as $record) {
|
2958
|
db_delete('menu_links')->condition('mlid', $record->mlid)->execute();
|
2959
|
}
|
2960
|
}
|
2961
|
|
2962
|
/**
|
2963
|
* Remove block_callback field from {menu_router}.
|
2964
|
*/
|
2965
|
function system_update_7064() {
|
2966
|
db_drop_field('menu_router', 'block_callback');
|
2967
|
}
|
2968
|
|
2969
|
/**
|
2970
|
* Remove the default value for sid.
|
2971
|
*/
|
2972
|
function system_update_7065() {
|
2973
|
$spec = array(
|
2974
|
'description' => "A session ID. The value is generated by Drupal's session handlers.",
|
2975
|
'type' => 'varchar',
|
2976
|
'length' => 128,
|
2977
|
'not null' => TRUE,
|
2978
|
);
|
2979
|
db_drop_primary_key('sessions');
|
2980
|
db_change_field('sessions', 'sid', 'sid', $spec, array('primary key' => array('sid', 'ssid')));
|
2981
|
// Delete any sessions with empty session ID.
|
2982
|
db_delete('sessions')->condition('sid', '')->execute();
|
2983
|
}
|
2984
|
|
2985
|
/**
|
2986
|
* Migrate the 'file_directory_temp' variable.
|
2987
|
*/
|
2988
|
function system_update_7066() {
|
2989
|
$d6_file_directory_temp = variable_get('file_directory_temp', file_directory_temp());
|
2990
|
variable_set('file_temporary_path', $d6_file_directory_temp);
|
2991
|
variable_del('file_directory_temp');
|
2992
|
}
|
2993
|
|
2994
|
/**
|
2995
|
* Grant administrators permission to view the administration theme.
|
2996
|
*/
|
2997
|
function system_update_7067() {
|
2998
|
// Users with access to administration pages already see the administration
|
2999
|
// theme in some places (if one is enabled on the site), so we want them to
|
3000
|
// continue seeing it.
|
3001
|
$admin_roles = user_roles(FALSE, 'access administration pages');
|
3002
|
foreach (array_keys($admin_roles) as $rid) {
|
3003
|
_update_7000_user_role_grant_permissions($rid, array('view the administration theme'), 'system');
|
3004
|
}
|
3005
|
// The above check is not guaranteed to reach all administrative users of the
|
3006
|
// site, so if the site is currently using an administration theme, display a
|
3007
|
// message also.
|
3008
|
if (variable_get('admin_theme')) {
|
3009
|
if (empty($admin_roles)) {
|
3010
|
drupal_set_message('The new "View the administration theme" permission is required in order to view your site\'s administration theme. You can grant this permission to your site\'s administrators on the <a href="' . url('admin/people/permissions', array('fragment' => 'module-system')) . '">permissions page</a>.');
|
3011
|
}
|
3012
|
else {
|
3013
|
drupal_set_message('The new "View the administration theme" permission is required in order to view your site\'s administration theme. This permission has been automatically granted to the following roles: <em>' . check_plain(implode(', ', $admin_roles)) . '</em>. You can grant this permission to other roles on the <a href="' . url('admin/people/permissions', array('fragment' => 'module-system')) . '">permissions page</a>.');
|
3014
|
}
|
3015
|
}
|
3016
|
}
|
3017
|
|
3018
|
/**
|
3019
|
* Update {url_alias}.language description.
|
3020
|
*/
|
3021
|
function system_update_7068() {
|
3022
|
$spec = array(
|
3023
|
'description' => "The language this alias is for; if 'und', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.",
|
3024
|
'type' => 'varchar',
|
3025
|
'length' => 12,
|
3026
|
'not null' => TRUE,
|
3027
|
'default' => '',
|
3028
|
);
|
3029
|
db_change_field('url_alias', 'language', 'language', $spec);
|
3030
|
}
|
3031
|
|
3032
|
/**
|
3033
|
* Remove the obsolete 'site_offline' variable.
|
3034
|
*
|
3035
|
* @see update_fix_d7_requirements()
|
3036
|
*/
|
3037
|
function system_update_7069() {
|
3038
|
variable_del('site_offline');
|
3039
|
}
|
3040
|
|
3041
|
/**
|
3042
|
* @} End of "defgroup updates-6.x-to-7.x".
|
3043
|
* The next series of updates should start at 8000.
|
3044
|
*/
|
3045
|
|
3046
|
/**
|
3047
|
* @defgroup updates-7.x-extra Extra updates for 7.x
|
3048
|
* @{
|
3049
|
* Update functions between 7.x versions.
|
3050
|
*/
|
3051
|
|
3052
|
/**
|
3053
|
* Remove the obsolete 'drupal_badge_color' and 'drupal_badge_size' variables.
|
3054
|
*/
|
3055
|
function system_update_7070() {
|
3056
|
variable_del('drupal_badge_color');
|
3057
|
variable_del('drupal_badge_size');
|
3058
|
}
|
3059
|
|
3060
|
/**
|
3061
|
* Add index missed during upgrade, and fix field default.
|
3062
|
*/
|
3063
|
function system_update_7071() {
|
3064
|
db_drop_index('date_format_type', 'title');
|
3065
|
db_add_index('date_format_type', 'title', array('title'));
|
3066
|
db_change_field('registry', 'filename', 'filename', array(
|
3067
|
'type' => 'varchar',
|
3068
|
'length' => 255,
|
3069
|
'not null' => TRUE,
|
3070
|
));
|
3071
|
}
|
3072
|
|
3073
|
/**
|
3074
|
* Remove the obsolete 'site_offline_message' variable.
|
3075
|
*
|
3076
|
* @see update_fix_d7_requirements()
|
3077
|
*/
|
3078
|
function system_update_7072() {
|
3079
|
variable_del('site_offline_message');
|
3080
|
}
|
3081
|
|
3082
|
/**
|
3083
|
* Add binary to {file_managed}, in case system_update_7034() was run without
|
3084
|
* it.
|
3085
|
*/
|
3086
|
function system_update_7073() {
|
3087
|
db_change_field('file_managed', 'filename', 'filename', array(
|
3088
|
'description' => 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.',
|
3089
|
'type' => 'varchar',
|
3090
|
'length' => 255,
|
3091
|
'not null' => TRUE,
|
3092
|
'default' => '',
|
3093
|
'binary' => TRUE,
|
3094
|
));
|
3095
|
db_drop_unique_key('file_managed', 'uri');
|
3096
|
db_change_field('file_managed', 'uri', 'uri', array(
|
3097
|
'description' => 'The URI to access the file (either local or remote).',
|
3098
|
'type' => 'varchar',
|
3099
|
'length' => 255,
|
3100
|
'not null' => TRUE,
|
3101
|
'default' => '',
|
3102
|
'binary' => TRUE,
|
3103
|
));
|
3104
|
db_add_unique_key('file_managed', 'uri', array('uri'));
|
3105
|
}
|
3106
|
|
3107
|
/**
|
3108
|
* This update has been removed and will not run.
|
3109
|
*/
|
3110
|
function system_update_7074() {
|
3111
|
// This update function previously converted menu_links query strings to
|
3112
|
// arrays. It has been removed for now due to incompatibility with
|
3113
|
// PostgreSQL.
|
3114
|
}
|
3115
|
|
3116
|
/**
|
3117
|
* Convert menu_links query strings into arrays.
|
3118
|
*/
|
3119
|
function system_update_7076() {
|
3120
|
$query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC))
|
3121
|
->fields('ml', array('mlid', 'options'));
|
3122
|
foreach ($query->execute() as $menu_link) {
|
3123
|
if (strpos($menu_link['options'], 'query') !== FALSE) {
|
3124
|
$menu_link['options'] = unserialize($menu_link['options']);
|
3125
|
if (isset($menu_link['options']['query']) && is_string($menu_link['options']['query'])) {
|
3126
|
$menu_link['options']['query'] = drupal_get_query_array($menu_link['options']['query']);
|
3127
|
db_update('menu_links')
|
3128
|
->fields(array(
|
3129
|
'options' => serialize($menu_link['options']),
|
3130
|
))
|
3131
|
->condition('mlid', $menu_link['mlid'], '=')
|
3132
|
->execute();
|
3133
|
}
|
3134
|
}
|
3135
|
}
|
3136
|
}
|
3137
|
|
3138
|
/**
|
3139
|
* Revert {file_managed}.filename changed to a binary column.
|
3140
|
*/
|
3141
|
function system_update_7077() {
|
3142
|
db_change_field('file_managed', 'filename', 'filename', array(
|
3143
|
'description' => 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.',
|
3144
|
'type' => 'varchar',
|
3145
|
'length' => 255,
|
3146
|
'not null' => TRUE,
|
3147
|
'default' => '',
|
3148
|
));
|
3149
|
}
|
3150
|
|
3151
|
|
3152
|
/**
|
3153
|
* Add binary to {date_formats}.format.
|
3154
|
*/
|
3155
|
function system_update_7078() {
|
3156
|
db_drop_unique_key('date_formats', 'formats');
|
3157
|
db_change_field('date_formats', 'format', 'format', array(
|
3158
|
'description' => 'The date format string.',
|
3159
|
'type' => 'varchar',
|
3160
|
'length' => 100,
|
3161
|
'not null' => TRUE,
|
3162
|
'binary' => TRUE,
|
3163
|
), array('unique keys' => array('formats' => array('format', 'type'))));
|
3164
|
}
|
3165
|
|
3166
|
/**
|
3167
|
* Convert the 'filesize' column in {file_managed} to a bigint.
|
3168
|
*/
|
3169
|
function system_update_7079() {
|
3170
|
$spec = array(
|
3171
|
'description' => 'The size of the file in bytes.',
|
3172
|
'type' => 'int',
|
3173
|
'size' => 'big',
|
3174
|
'unsigned' => TRUE,
|
3175
|
'not null' => TRUE,
|
3176
|
'default' => 0,
|
3177
|
);
|
3178
|
db_change_field('file_managed', 'filesize', 'filesize', $spec);
|
3179
|
}
|
3180
|
|
3181
|
/**
|
3182
|
* Convert the 'format' column in {date_format_locale} to case sensitive varchar.
|
3183
|
*/
|
3184
|
function system_update_7080() {
|
3185
|
$spec = array(
|
3186
|
'description' => 'The date format string.',
|
3187
|
'type' => 'varchar',
|
3188
|
'length' => 100,
|
3189
|
'not null' => TRUE,
|
3190
|
'binary' => TRUE,
|
3191
|
);
|
3192
|
db_change_field('date_format_locale', 'format', 'format', $spec);
|
3193
|
}
|
3194
|
|
3195
|
/**
|
3196
|
* @} End of "defgroup updates-7.x-extra".
|
3197
|
* The next series of updates should start at 8000.
|
3198
|
*/
|