Changeset 23037 for extensions/community/main.inc.php
- Timestamp:
- Jun 4, 2013, 12:55:59 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/main.inc.php
r21751 r23037 14 14 } 15 15 16 global $prefixeTable; 17 18 // +-----------------------------------------------------------------------+ 19 // | Define plugin constants | 20 // +-----------------------------------------------------------------------+ 21 22 defined('COMMUNITY_ID') or define('COMMUNITY_ID', basename(dirname(__FILE__))); 16 23 define('COMMUNITY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 17 18 global $prefixeTable;19 24 define('COMMUNITY_PERMISSIONS_TABLE', $prefixeTable.'community_permissions'); 20 25 define('COMMUNITY_PENDINGS_TABLE', $prefixeTable.'community_pendings'); 26 define('COMMUNITY_VERSION', 'auto'); 21 27 22 28 include_once(COMMUNITY_PATH.'include/functions_community.inc.php'); 29 30 // init the plugin 31 add_event_handler('init', 'community_init'); 32 /** 33 * plugin initialization 34 * - check for upgrades 35 * - unserialize configuration 36 * - load language 37 */ 38 function 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 = ' 57 UPDATE '. PLUGINS_TABLE .' 58 SET version = "'. COMMUNITY_VERSION .'" 59 WHERE id = "'. COMMUNITY_ID .'"'; 60 pwg_query($query); 61 62 $pwg_loaded_plugins[COMMUNITY_ID]['version'] = COMMUNITY_VERSION; 63 } 64 } 65 } 23 66 24 67 /* Plugin admin */
Note: See TracChangeset
for help on using the changeset viewer.