Ignore:
Timestamp:
Jun 14, 2011, 6:41:10 PM (13 years ago)
Author:
mistic100
Message:

Add event_handler on 'login_success' and 'invalidate_user_cache' to regenerate SmartAlbums content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/maintain.inc.php

    r11333 r11376  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 function plugin_install() {
     4function plugin_install()
     5{
    56        global $prefixeTable;
    67
     
    1617 
    1718  /* add a collumn to image_category_table */
    18   pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM("true", "false") NOT NULL DEFAULT "false";');
     19  pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM(\'true\', \'false\') NOT NULL DEFAULT \'false\';');
    1920     
    2021  /* config parameter */
    21   // pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
    22     // VALUES ('SmartAlbums', '', 'Configuration for SmartAlbums plugin');");
     22  pwg_query('
     23INSERT INTO `' . CONFIG_TABLE . '`
     24  VALUES (
     25    \'SmartAlbums\',
     26    \''.serialize(array(
     27        'update_on_upload' => false,
     28        'update_on_login' => false,
     29        )
     30      ).'\',
     31    \'Configuration for SmartAlbums plugin\'
     32  )
     33;');
     34
    2335}
    2436
    25 function plugin_uninstall() {
     37function plugin_activate()
     38{
     39  global $conf;
     40 
     41  if (!isset($conf['SmartAlbums']))
     42  {
     43    pwg_query('
     44INSERT INTO `' . CONFIG_TABLE . '`
     45  VALUES (
     46    \'SmartAlbums\',
     47    \''.serialize(array(
     48        'update_on_upload' => false,
     49        'update_on_login' => false,
     50        )
     51      ).'\',
     52    \'Configuration for SmartAlbums plugin\'
     53  )
     54;');
     55  }
     56 
     57}
     58
     59function plugin_uninstall()
     60{
    2661        global $prefixeTable;
    2762 
    2863  pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;');
    2964  pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;');
    30   pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = "SmartAlbums";');
     65  pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';');
    3166}
    3267?>
Note: See TracChangeset for help on using the changeset viewer.