Changeset 953


Ignore:
Timestamp:
Nov 24, 2005, 10:37:29 PM (18 years ago)
Author:
plg
Message:
  • new: system to notify and upgrade database among developers
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r879 r953  
    132132mysql_select_db( $cfgBase )
    133133or die ( "Could not connect to database" );
    134        
     134
     135if ($conf['check_upgrade_feed'])
     136{
     137  define('PREFIX_TABLE', $prefixeTable);
     138  define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db');
     139 
     140  // retrieve already applied upgrades
     141  $query = '
     142SELECT id
     143  FROM '.PREFIX_TABLE.'upgrade
     144;';
     145  $applied = array_from_query($query, 'id');
     146
     147  // retrieve existing upgrades
     148  $existing = array();
     149
     150  if ($contents = opendir(UPGRADES_PATH))
     151  {
     152    while (($node = readdir($contents)) !== false)
     153    {
     154      if (is_file(UPGRADES_PATH.'/'.$node)
     155          and preg_match('/^(.*?)-database\.php$/', $node, $match))
     156      {
     157        array_push($existing, $match[1]);
     158      }
     159    }
     160  }
     161  natcasesort($existing);
     162
     163  // which upgrades need to be applied?
     164  if (count(array_diff($existing, $applied)) > 0)
     165  {
     166    echo
     167      '<p>'
     168      .'Some database upgrades are missing, '
     169      .'<a href="'.PHPWG_ROOT_PATH.'upgrade_feed.php">upgrade now</a>'
     170      .'</p>'
     171      ;
     172  }
     173}
     174
    135175//
    136176// Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
  • trunk/include/config_default.inc.php

    r937 r953  
    183183$conf['mail_options'] = false;
    184184
     185// check_upgrade_feed: check if there are database upgrade required. Set to
     186// true, a message will strongly encourage you to upgrade your database if
     187// needed.
     188//
     189// This configuration parameter is set to true in BSF branch and to false
     190// elsewhere.
     191$conf['check_upgrade_feed'] = true;
     192
    185193// +-----------------------------------------------------------------------+
    186194// |                               metadata                                |
  • trunk/include/constants.php

    r879 r953  
    6060define('USER_CACHE_TABLE', $prefixeTable.'user_cache');
    6161define('CADDIE_TABLE', $prefixeTable.'caddie');
     62define('UPGRADE_TABLE', $prefixeTable.'upgrade');
    6263?>
  • trunk/install/phpwebgallery_structure.sql

    r860 r953  
    202202
    203203--
     204-- Table structure for table `phpwebgallery_upgrade`
     205--
     206
     207DROP TABLE IF EXISTS `phpwebgallery_upgrade`;
     208CREATE TABLE `phpwebgallery_upgrade` (
     209  `id` varchar(20) NOT NULL default '',
     210  `applied` datetime NOT NULL default '0000-00-00 00:00:00',
     211  `description` varchar(255) default NULL,
     212  PRIMARY KEY  (`id`)
     213) TYPE=MyISAM;
     214
     215--
    204216-- Table structure for table `phpwebgallery_user_access`
    205217--
Note: See TracChangeset for help on using the changeset viewer.