diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-20 20:59:18 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-20 20:59:18 -0700 |
| commit | a00619b812393cf73d1c188af7961af820d36185 (patch) | |
| tree | d19e6bf187c56bfc0a4c72db2adfb5e9560aa154 /modules/gallery/helpers/gallery_installer.php | |
| parent | 09f998e7a5a58720636c7b1140279b5efbdb33c6 (diff) | |
* Move the captured field into the exif module where it is created and populated.
* Create a new API event get_sort_fields that allows modules to contribute new sort fields that they manage. the only condition is that the module needs to add it to the item table.
* Changed g2_import to call this api to get the allowable sort fields
* Changed album::get_edit_form to call this new api to get the available sort fields
Partial fix for ticket #627, as the Capture date is not available until the exif module is installed.
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
| -rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 6500482b..aebb7a32 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -68,7 +68,6 @@ class gallery_installer { $db->query("CREATE TABLE {items} ( `id` int(9) NOT NULL auto_increment, `album_cover_item_id` int(9) default NULL, - `captured` int(9) default NULL, `created` int(9) default NULL, `description` varchar(2048) default NULL, `height` int(9) default NULL, @@ -268,7 +267,7 @@ class gallery_installer { module::set_var("gallery", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); - module::set_version("gallery", 12); + module::set_version("gallery", 13); } static function upgrade($version) { @@ -364,6 +363,20 @@ class gallery_installer { $db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL"); module::set_version("gallery", $version = 12); } + + if ($version == 12) { + // remove the capture field if exif is not installed and it has no data + if (!module::is_active("exif")) { + $total_records = $db->query("SELECT COUNT(id) as total_records FROM {items}") + ->current()->total_records; + $count_null = $db->query("SELECT COUNT(id) as count_null FROM {items} where `captured`is NULL") + ->current()->count_null; + if ($total_records == $count_null) { + $db->query("ALTER TABLE {items} DROP COLUMN `captured`"); + } + } + module::set_version("gallery", $version = 13); + } } static function uninstall() { |
