View source
<?php
function image_fupload_install() {
$image_node_types = variable_get('image_node_types', array());
if (empty($image_node_types['image'])) {
$image_node_types['image'] = array(
'title' => 'Image',
'fieldname' => 'images',
'image_selection' => 'preview',
'imagecache_preset' => '',
);
variable_set('image_node_types', $image_node_types);
}
drupal_install_schema('image_fupload');
}
function image_fupload_uninstall() {
$variables = array(
'fupload_title_replacements',
'fupload_previewlist_img_attributes',
'fupload_previewlist_field_settings',
'image_node_types',
);
for ($i = 0; $i < count($variables); $i++) {
variable_del($variables[$i]);
}
drupal_uninstall_schema('image_fupload');
}
function image_fupload_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$path = drupal_get_path('module', 'image_fupload') . '/swfupload/';
if (!file_exists($path . 'swfupload.js') || !file_exists($path . 'swfupload.queue.js') || !file_exists($path . 'swfupload.swf')) {
$requirements['image_fupload'] = array(
'title' => t('Image FUpload'),
'value' => t('Missing or wrong files in subdirectory "swfupload"'),
'description' => t('Some needed files which are not bundled with this module, are missing or out-of-date! This can be either "swfupload.swf", "swfupload.js" or "swfupload.queue.js" which should be located in "%path". These files can be downloaded from !page. <em>Note:</em> Version 2.2.0 or higher is needed.', array(
'%path' => $path,
'!page' => l(t('SWFUploads project page'), 'http://code.google.com/p/swfupload/'),
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
function image_fupload_schema() {
return image_fupload_schema_1();
}
function image_fupload_schema_1() {
$schema['fupload_previewlist'] = array(
'description' => t('Caches images for image preview list.'),
'fields' => array(
'fieldname' => array(
'type' => 'varchar',
'length' => '32',
'default' => '',
'not null' => TRUE,
'description' => t('Stores name of our image field depending on used node type.'),
'no export' => TRUE,
),
'uid' => array(
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'description' => t('Stores user id.'),
'no export' => TRUE,
),
'nid' => array(
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'description' => t('Stores node id.'),
'no export' => TRUE,
),
'fid' => array(
'type' => 'int',
'default' => 0,
'not null' => FALSE,
'description' => t('Stores file id of uploaded image.'),
'no export' => TRUE,
),
'created' => array(
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'description' => t('Stores creation time to do some clean up by cron.'),
'no export' => TRUE,
),
),
'indexes' => array(
'fieldname' => array(
'fieldname',
),
'uid' => array(
'uid',
),
),
'primary key' => array(
'fid',
),
);
return $schema;
}
function image_fupload_update_6100() {
$ret = array();
return $ret;
}
function image_fupload_update_6110() {
$ret = array();
$image_node_types = variable_get('image_node_types', array());
if (empty($image_node_types['image'])) {
$image_node_types['image'] = array(
'title' => 'Image',
'fieldname' => 'images',
'image_selection' => 'preview',
'imagecache_preset' => '',
);
variable_set('image_node_types', $image_node_types);
}
return $ret;
}
function image_fupload_update_6300() {
$ret = array();
$schema = image_fupload_schema_1();
_drupal_initialize_schema('image_fupload', $schema);
foreach ($schema as $name => $table) {
db_create_table($ret, $name, $table);
}
return $ret;
}
function image_fupload_update_6301() {
$ret = array();
return $ret;
}
function image_fupload_update_6304() {
$ret = array();
return $ret;
}