2009-08-29 12:52:32 +00:00
<?php
/**
* @file
* Install, update and uninstall functions for File module.
*/
2012-08-31 01:27:21 +00:00
/**
* Implements hook_schema().
*/
function file_schema() {
2017-03-04 01:20:24 +00:00
$schema['file_usage'] = [
2012-08-31 01:27:21 +00:00
'description' => 'Track where a file is used.',
2017-03-04 01:20:24 +00:00
'fields' => [
'fid' => [
2012-08-31 01:27:21 +00:00
'description' => 'File ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
2017-03-04 01:20:24 +00:00
],
'module' => [
2012-08-31 01:27:21 +00:00
'description' => 'The name of the module that is using the file.',
2015-05-05 16:42:09 +00:00
'type' => 'varchar_ascii',
2013-06-19 09:14:55 +00:00
'length' => DRUPAL_EXTENSION_NAME_MAX_LENGTH,
2012-08-31 01:27:21 +00:00
'not null' => TRUE,
'default' => '',
2017-03-04 01:20:24 +00:00
],
'type' => [
2012-08-31 01:27:21 +00:00
'description' => 'The name of the object type in which the file is used.',
2015-05-05 16:42:09 +00:00
'type' => 'varchar_ascii',
2012-08-31 01:27:21 +00:00
'length' => 64,
'not null' => TRUE,
'default' => '',
2017-03-04 01:20:24 +00:00
],
'id' => [
2012-08-31 01:27:21 +00:00
'description' => 'The primary key of the object using the file.',
2015-05-05 16:42:09 +00:00
'type' => 'varchar_ascii',
2013-04-13 17:06:40 +00:00
'length' => 64,
2012-08-31 01:27:21 +00:00
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
'count' => [
2012-08-31 01:27:21 +00:00
'description' => 'The number of times this file is used by this object.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2017-03-04 01:20:24 +00:00
],
],
'primary key' => ['fid', 'type', 'id', 'module'],
'indexes' => [
'type_id' => ['type', 'id'],
'fid_count' => ['fid', 'count'],
'fid_module' => ['fid', 'module'],
],
];
2012-08-31 01:27:21 +00:00
return $schema;
}
2009-08-29 12:52:32 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_requirements().
2009-08-29 12:52:32 +00:00
*
* Display information about getting upload progress bars working.
*/
function file_requirements($phase) {
2017-03-04 01:20:24 +00:00
$requirements = [];
2009-08-29 12:52:32 +00:00
// Check the server's ability to indicate upload progress.
if ($phase == 'runtime') {
2015-03-31 14:52:58 +00:00
$description = NULL;
2009-08-29 12:52:32 +00:00
$implementation = file_progress_implementation();
2013-09-16 03:58:06 +00:00
$server_software = \Drupal::request()->server->get('SERVER_SOFTWARE');
2015-03-31 14:52:58 +00:00
// Test the web server identity.
if (preg_match("/Nginx/i", $server_software)) {
$is_nginx = TRUE;
$is_apache = FALSE;
$fastcgi = FALSE;
}
elseif (preg_match("/Apache/i", $server_software)) {
$is_nginx = FALSE;
$is_apache = TRUE;
$fastcgi = strpos($server_software, 'mod_fastcgi') !== FALSE || strpos($server_software, 'mod_fcgi') !== FALSE;
}
else {
$is_nginx = FALSE;
$is_apache = FALSE;
$fastcgi = FALSE;
}
if (!$is_apache && !$is_nginx) {
2009-08-29 12:52:32 +00:00
$value = t('Not enabled');
2015-03-31 14:52:58 +00:00
$description = t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php or Nginx with PHP-FPM.');
2009-08-29 12:52:32 +00:00
}
elseif ($fastcgi) {
$value = t('Not enabled');
2015-03-31 14:52:58 +00:00
$description = t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php or PHP-FPM and not as FastCGI.');
2009-08-29 12:52:32 +00:00
}
elseif (!$implementation) {
$value = t('Not enabled');
2016-12-16 23:25:48 +00:00
$description = t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the <a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress library</a>.');
2009-08-29 12:52:32 +00:00
}
elseif ($implementation == 'uploadprogress') {
2016-01-05 14:31:39 +00:00
$value = t('Enabled (<a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress</a>)');
2009-08-29 12:52:32 +00:00
}
2017-03-04 01:20:24 +00:00
$requirements['file_progress'] = [
2009-08-29 12:52:32 +00:00
'title' => t('Upload progress'),
'value' => $value,
'description' => $description,
2017-03-04 01:20:24 +00:00
];
2009-08-29 12:52:32 +00:00
}
return $requirements;
}
Issue #2801777 by Berdir, Wim Leers, Pol, alexpott, dawehner, Jo Fitzgerald, Munavijayalakshmi, poornima.n, ifrik, Bojhan, catch: Prevent drupal from deleting temporary files
2017-07-21 08:32:10 +00:00
/**
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
* Implements hook_update_last_removed().
2018-09-12 21:27:17 +00:00
*/
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
function file_update_last_removed() {
return 8700;
2018-09-12 21:27:17 +00:00
}