Ignore:
Timestamp:
Nov 24, 2005, 10:37:29 PM (18 years ago)
Author:
plg
Message:
  • new: system to notify and upgrade database among developers
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.