Changeset 16104 for extensions/SmartAlbums/maintain.inc.php
- Timestamp:
- Jun 27, 2012, 9:19:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/maintain.inc.php
r11451 r16104 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 global $prefixeTable; 5 define('smart_table', $prefixeTable . 'category_filters'); 6 7 define('smart_default_config', serialize(array( 8 'update_on_upload' => false, 9 'show_list_messages' => true, 10 ))); 11 4 12 function plugin_install() 5 13 { 6 global $prefixeTable;7 8 14 /* create table to store filters */ 9 15 pwg_query( 10 'CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'category_filters` (16 'CREATE TABLE IF NOT EXISTS `' . smart_table . '` ( 11 17 `category_id` smallint(5) unsigned NOT NULL, 12 18 `type` varchar(16) NOT NULL, … … 20 26 21 27 /* config parameter */ 22 pwg_query(' 23 INSERT INTO `' . CONFIG_TABLE . '` 24 VALUES ( 25 \'SmartAlbums\', 26 \''.serialize(array( 27 'update_on_upload' => false, 28 'show_list_messages' => true, 29 ) 30 ).'\', 31 \'Configuration for SmartAlbums plugin\' 32 ) 33 ;'); 34 28 conf_update_param('SmartAlbums', smart_default_config); 35 29 } 36 30 … … 41 35 if (!isset($conf['SmartAlbums'])) 42 36 { 43 pwg_query(' 44 INSERT INTO `' . CONFIG_TABLE . '` 45 VALUES ( 46 \'SmartAlbums\', 47 \''.serialize(array( 48 'update_on_upload' => false, 49 'show_list_messages' => true, 50 ) 51 ).'\', 52 \'Configuration for SmartAlbums plugin\' 53 ) 54 ;'); 37 conf_update_param('SmartAlbums', smart_default_config); 38 } 39 40 /* some filters renamed in 1.2 */ 41 $name_changes = array( 42 'the' => 'the_post', 43 'before' => 'before_post', 44 'after' => 'after_post', 45 'the_crea' => 'the_taken', 46 'before_crea' => 'before_taken', 47 'after_crea' => 'after_taken', 48 ); 49 foreach ($name_changes as $old => $new) 50 { 51 pwg_query('UPDATE TABLE ' . smart_table . ' SET cond = "'.$new.'" WHERE cond = "'.$old.'";'); 55 52 } 56 53 } 57 54 58 55 function plugin_uninstall() 59 { 60 global $prefixeTable; 61 62 pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;'); 56 { 57 pwg_query('DROP TABLE `' . smart_table . '`;'); 63 58 pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;'); 64 pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\' ;');59 pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\' LIMIT 1;'); 65 60 } 61 66 62 ?>
Note: See TracChangeset
for help on using the changeset viewer.