aboutsummaryrefslogtreecommitdiff
path: root/exif.install
diff options
context:
space:
mode:
Diffstat (limited to 'exif.install')
-rwxr-xr-xexif.install89
1 files changed, 74 insertions, 15 deletions
diff --git a/exif.install b/exif.install
index cc1373d..75bf5d2 100755
--- a/exif.install
+++ b/exif.install
@@ -1,26 +1,85 @@
<?php
-// $Id: exif.install,v 1.4.2.6 2010/04/27 20:53:13 rapsli Exp $
-/**
- * @file the install part of the module
-*/
+// $Id: exif.install,v 1.4 2008/04/05 23:22:05 davidlesieur Exp $
/**
* Implementation of hook_install().
*/
function exif_install() {
- db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", -10, 'exif');
+ switch ($GLOBALS['db_type']) {
+ case 'mysql':
+ case 'mysqli':
+ db_query("CREATE TABLE {exif_tags} (
+ ifd int(10) unsigned NOT NULL default '0',
+ tag int(10) unsigned NOT NULL default '0',
+ status int(10) unsigned NOT NULL default '0',
+ weight int(11) NOT NULL default '0',
+ PRIMARY KEY (ifd, tag)
+ ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
+ );
+ db_query("CREATE TABLE {exif} (
+ fid int(10) unsigned NOT NULL default '0',
+ ifd int(10) unsigned NOT NULL default '0',
+ tag int(10) unsigned NOT NULL default '0',
+ value varchar(255) NOT NULL default '',
+ PRIMARY KEY (fid, ifd, tag)
+ ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
+ );
+ break;
+ case 'pgsql':
+ db_query("CREATE TABLE {exif_tags} (
+ ifd integer NOT NULL default '0',
+ tag integer NOT NULL default '0',
+ status integer NOT NULL default '0',
+ weight integer NOT NULL default '0',
+ PRIMARY KEY (ifd, tag)
+ );"
+ );
+ db_query("CREATE TABLE {exif} (
+ fid int(10) unsigned NOT NULL default '0',
+ ifd int(10) unsigned NOT NULL default '0',
+ tag int(10) unsigned NOT NULL default '0',
+ value varchar(255) NOT NULL default '',
+ PRIMARY KEY (fid, ifd, tag)
+ );"
+ );
+ break;
+ }
}
-function exif_requirements($phase) {
- $t = get_t();
- if ($phase == 'runtime' || $phase == 'install') {
- if (!function_exists('exif_read_data')) {
- $requirements['exif_read_data'] = array(
- 'title' => $t('Function exif_read_data not available'),
- 'value' => $t('The Function exif_read_data is not available on the system.'),
- 'severity' => REQUIREMENT_ERROR,
+function exif_update_1() {
+ // Works for postgres??
+ $ret[] = update_sql('ALTER TABLE {exif} RENAME TO {exif_tags}');
+ // make new table for caching and tracking exif data.
+ switch ($GLOBALS['db_type']) {
+ case 'mysql':
+ case 'mysqli':
+ $ret[] = update_sql("CREATE TABLE {exif} (
+ fid int(10) unsigned NOT NULL default '0',
+ ifd int(10) unsigned NOT NULL default '0',
+ tag int(10) unsigned NOT NULL default '0',
+ value varchar(255) NOT NULL default '',
+ PRIMARY KEY (fid, ifd, tag)
+ ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
+ );
+ break;
+ case 'pgsql':
+ $ret[] = update_sql("CREATE TABLE {exif} (
+ fid int(10) unsigned NOT NULL default '0',
+ ifd int(10) unsigned NOT NULL default '0',
+ tag int(10) unsigned NOT NULL default '0',
+ value varchar(255) NOT NULL default '',
+ PRIMARY KEY (fid, ifd, tag)
+ );"
);
- }
+ break;
}
- return $requirements;
+ return $ret;
}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function exif_uninstall() {
+ db_query('DROP TABLE {exif_tags}');
+ db_query('DROP TABLE {exif}');
+} \ No newline at end of file