Ignore:
Timestamp:
Jun 4, 2013, 12:55:59 PM (11 years ago)
Author:
plg
Message:

manage quota (number of photos, disk usage)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/main.inc.php

    r21751 r23037  
    1414}
    1515
     16global $prefixeTable;
     17
     18// +-----------------------------------------------------------------------+
     19// | Define plugin constants                                               |
     20// +-----------------------------------------------------------------------+
     21
     22defined('COMMUNITY_ID') or define('COMMUNITY_ID', basename(dirname(__FILE__)));
    1623define('COMMUNITY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    17 
    18 global $prefixeTable;
    1924define('COMMUNITY_PERMISSIONS_TABLE', $prefixeTable.'community_permissions');
    2025define('COMMUNITY_PENDINGS_TABLE', $prefixeTable.'community_pendings');
     26define('COMMUNITY_VERSION', 'auto');
    2127
    2228include_once(COMMUNITY_PATH.'include/functions_community.inc.php');
     29
     30// init the plugin
     31add_event_handler('init', 'community_init');
     32/**
     33 * plugin initialization
     34 *   - check for upgrades
     35 *   - unserialize configuration
     36 *   - load language
     37 */
     38function community_init()
     39{
     40  global $conf, $pwg_loaded_plugins;
     41
     42  // apply upgrade if needed
     43  if (
     44    COMMUNITY_VERSION == 'auto' or
     45    $pwg_loaded_plugins[COMMUNITY_ID]['version'] == 'auto' or
     46    version_compare($pwg_loaded_plugins[COMMUNITY_ID]['version'], COMMUNITY_VERSION, '<')
     47  )
     48  {
     49    // call install function
     50    include_once(COMMUNITY_PATH.'include/install.inc.php');
     51    community_install();
     52
     53    // update plugin version in database
     54    if ( $pwg_loaded_plugins[COMMUNITY_ID]['version'] != 'auto' and COMMUNITY_VERSION != 'auto' )
     55    {
     56      $query = '
     57UPDATE '. PLUGINS_TABLE .'
     58SET version = "'. COMMUNITY_VERSION .'"
     59WHERE id = "'. COMMUNITY_ID .'"';
     60      pwg_query($query);
     61
     62      $pwg_loaded_plugins[COMMUNITY_ID]['version'] = COMMUNITY_VERSION;
     63    }
     64  }
     65}
    2366
    2467/* Plugin admin */
Note: See TracChangeset for help on using the changeset viewer.