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/maintain.inc.php

    r21289 r23037  
    11<?php
     2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    23
    34if (!defined("COMMUNITY_PATH"))
     
    67}
    78
     9include_once(COMMUNITY_PATH.'/include/install.inc.php');
     10
    811function plugin_install()
    912{
    10   global $conf, $prefixeTable;
    11 
    12   $query = '
    13 CREATE TABLE '.$prefixeTable.'community_permissions (
    14   id int(11) NOT NULL AUTO_INCREMENT,
    15   type varchar(255) NOT NULL,
    16   group_id smallint(5) unsigned DEFAULT NULL,
    17   user_id smallint(5) DEFAULT NULL,
    18   category_id smallint(5) unsigned DEFAULT NULL,
    19   recursive enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
    20   create_subcategories enum(\'true\',\'false\') NOT NULL DEFAULT \'false\',
    21   moderated enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
    22   PRIMARY KEY (id)
    23 ) ENGINE=MyISAM DEFAULT CHARACTER SET utf8
    24 ;';
    25   pwg_query($query);
    26 
    27   $query = '
    28 CREATE TABLE '.$prefixeTable.'community_pendings (
    29   image_id mediumint(8) unsigned NOT NULL,
    30   state varchar(255) NOT NULL,
    31   added_on datetime NOT NULL,
    32   validated_by smallint(5) DEFAULT NULL
    33 ) ENGINE=MyISAM DEFAULT CHARACTER SET utf8
    34 ;';
    35   pwg_query($query);
     13  community_install();
     14  define('community_installed', true);
    3615}
    3716
     
    5029{
    5130  global $prefixeTable;
    52 
    53   $are_new_tables_installed = false;
    54  
    55   $query = 'SHOW TABLES;';
    56   $result = pwg_query($query);
    57   while ($row = pwg_db_fetch_row($result))
    58   {
    59     if ($prefixeTable.'community_permissions' == $row[0])
    60     {
    61       $are_new_tables_installed = true;
    62     }
    63   }
    64 
    65   if (!$are_new_tables_installed)
    66   {
    67     plugin_install();
     31 
     32  if (!defined('community_installed')) // a plugin is activated just after its installation
     33  {
     34    community_install();
    6835  }
    6936
Note: See TracChangeset for help on using the changeset viewer.