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
2023-12-16 16:58:44 +00:00
if ( $phase != 'runtime' ) {
return $requirements ;
}
$server_software = \Drupal :: request () -> server -> get ( 'SERVER_SOFTWARE' , '' );
2015-03-31 14:52:58 +00:00
2023-12-16 16:58:44 +00:00
// Get the web server identity.
$is_nginx = preg_match ( " /Nginx/i " , $server_software );
$is_apache = preg_match ( " /Apache/i " , $server_software );
$fastcgi = $is_apache && (( str_contains ( $server_software , 'mod_fastcgi' ) || str_contains ( $server_software , 'mod_fcgi' )));
// Check the uploadprogress extension is loaded.
if ( extension_loaded ( 'uploadprogress' )) {
$value = t ( 'Enabled (<a href="http://pecl.php.net/package/uploadprogress">PECL uploadprogress</a>)' );
$description = NULL ;
}
else {
$value = t ( 'Not enabled' );
$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>.' );
}
2015-03-31 14:52:58 +00:00
2023-12-16 16:58:44 +00:00
// Adjust the requirement depending on what the server supports.
if ( ! $is_apache && ! $is_nginx ) {
$value = t ( 'Not enabled' );
$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.' );
}
elseif ( $fastcgi ) {
$value = t ( 'Not enabled' );
$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
}
2023-12-16 16:58:44 +00:00
$requirements [ 'file_progress' ] = [
'title' => t ( 'Upload progress' ),
'value' => $value ,
'description' => $description ,
];
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
}