epsacrop.install in EPSA Crop - Image Cropping 6
Same filename and directory in other branches
install file for epsacrop.module
File
epsacrop.installView source
<?php
/**
* @file
* install file for epsacrop.module
*/
function epsacrop_schema() {
$schema['epsacrop_files'] = array(
'description' => t('TODO: please describe this table!'),
'fields' => array(
'fid' => array(
'description' => t('TODO: please describe this field!'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'coords' => array(
'description' => t('TODO: please describe this field!'),
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
'nid' => array(
'description' => t('TODO: please describe this field!'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => t('TODO: please describe this field!'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'fid',
),
);
return $schema;
}
function epsacrop_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'install') {
// The epsacrop_jcrop_get_version() function is in the .module file, which isn't
// loaded yet.
include_once dirname(__FILE__) . '/epsacrop.module';
}
$requirements['epsacrop_jcrop']['title'] = $t('EPSA Crop : Jcrop');
$requirements['epsacrop_json2']['title'] = $t('EPSA Crop : json2.js');
if ($version = epsacrop_jcrop_get_version() || _epsacrop_is_json2_exists()) {
$version = epsacrop_jcrop_get_version();
// Everything looks good; display the current Jcrop version.
if ($version) {
$requirements['epsacrop_jcrop']['value'] = 'Jcrop version : ' . $version;
$requirements['epsacrop_jcrop']['severity'] = REQUIREMENT_OK;
}
if (_epsacrop_is_json2_exists()) {
$requirements['epsacrop_json2']['value'] = 'JSON file (json2.js) OK';
$requirements['epsacrop_json2']['severity'] = REQUIREMENT_OK;
}
}
else {
// Required libraies wasn't found. Abort installation.
if (!epsacrop_jcrop_get_version()) {
$requirements['epsacrop_jcrop']['value'] = $t('Not found');
$requirements['epsacrop_jcrop']['description'] = $t('The <a href="@jcrop">Jcrop</a> plugin is missing. <a href="@download">Download</a> and extract it in your <em>sites/all/libraries</em> directory.', array(
'@jcrop' => 'http://deepliquid.com/content/Jcrop.html',
'@download' => 'http://code.google.com/p/jcrop/downloads/detail?name=jquery.Jcrop-0.9.8.zip&can=2',
));
$requirements['epsacrop_jcrop']['severity'] = REQUIREMENT_ERROR;
}
if (!_epsacrop_is_json2_exists()) {
$requirements['epsacrop_json2']['value'] = $t('Not found');
$requirements['epsacrop_json2']['description'] = $t("The <a href='@json2'>json2.js</a> file is missing, you can download it <a href='@downjson2'>here</a> and put it in your <em>sites/all/libraries</em> directory. Don't forget rename the downloaded folder into json2. At the end, you should have something like this sites/all/libraries/json2", array(
'@json2' => 'http://www.json.org/js.html',
'@downjson2' => 'https://github.com/douglascrockford/JSON-js',
));
$requirements['epsacrop_json2']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
function epsacrop_install() {
drupal_install_schema('epsacrop');
db_query("UPDATE {system} SET weight = 10 WHERE name = '%s'", 'epsacrop');
}
function epsacrop_uninstall() {
drupal_uninstall_schema('epsacrop');
}
Functions
Name![]() |
Description |
---|---|
epsacrop_install | |
epsacrop_requirements | |
epsacrop_schema | @file install file for epsacrop.module |
epsacrop_uninstall |