['.get_elapsed_time($last_time, $new_time).']'; echo ' Basic database structure upgrade done'; flush(); $last_time = $new_time; execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', 'phpwebgallery_', PREFIX_TABLE); $queries = array( " UPDATE phpwebgallery_config SET value = '".$save['prefix_thumbnail']."' WHERE param = 'prefix_thumbnail' ;", " UPDATE phpwebgallery_config SET value = '".$save['mail_webmaster']."' WHERE param = 'mail_webmaster' ;" ); foreach ($queries as $query) { $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); pwg_query($query); } $new_time = get_moment(); echo '
['.get_elapsed_time($last_time, $new_time).']';
echo ' Saved configuration information restored
'; flush(); $last_time = $new_time; // filling the new column categories.uppercats $id_uppercats = array(); $query = ' SELECT id, id_uppercat FROM '.CATEGORIES_TABLE.' ;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '') { $row['id_uppercat'] = 'NULL'; } $id_uppercats[$row['id']] = $row['id_uppercat']; } $datas = array(); foreach (array_keys($id_uppercats) as $id) { $data = array(); $data['id'] = $id; $uppercats = array(); array_push($uppercats, $id); while (isset($id_uppercats[$id]) and $id_uppercats[$id] != 'NULL') { array_push($uppercats, $id_uppercats[$id]); $id = $id_uppercats[$id]; } $data['uppercats'] = implode(',', array_reverse($uppercats)); array_push($datas, $data); } $fields = array('primary' => array('id'), 'update' => array('uppercats')); mass_updates(CATEGORIES_TABLE, $fields, $datas); $new_time = get_moment(); echo '
['.get_elapsed_time($last_time, $new_time).']';
echo ' filling the new column categories.uppercats
'; flush(); $last_time = $new_time; // refresh calculated datas ordering(); update_global_rank(); update_category(); $new_time = get_moment(); echo '
['.get_elapsed_time($last_time, $new_time).']';
echo ' Calculated data updated (categories.rank, categories.global_rank,
categories.date_last, categories.representative_picture_id,
categories.nb_images)
'; flush(); $last_time = $new_time; // update calculated field "images.path" $cat_ids = array(); $query = ' SELECT DISTINCT(storage_category_id) AS unique_storage_category_id FROM '.IMAGES_TABLE.' ;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { array_push($cat_ids, $row['unique_storage_category_id']); } $fulldirs = get_fulldirs($cat_ids); foreach ($cat_ids as $cat_id) { $query = ' UPDATE '.IMAGES_TABLE.' SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) WHERE storage_category_id = '.$cat_id.' ;'; pwg_query($query); } $new_time = get_moment(); echo '
['.get_elapsed_time($last_time, $new_time).']';
echo ' new column images.path filled
'; flush(); $last_time = $new_time; // all sub-categories of private categories become private $cat_ids = array(); $query = ' SELECT id FROM '.CATEGORIES_TABLE.' WHERE status = \'private\' ;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { array_push($cat_ids, $row['id']); } if (count($cat_ids) > 0) { $privates = get_subcat_ids($cat_ids); $query = ' UPDATE '.CATEGORIES_TABLE.' SET status = \'private\' WHERE id IN ('.implode(',', $privates).') ;'; pwg_query($query); } $new_time = get_moment(); echo '
['.get_elapsed_time($last_time, $new_time).']';
echo ' all sub-categories of private categories become private
'; flush(); $last_time = $new_time; $infos = array( 'user permissions and group permissions have been erased', 'only thumbnails prefix and webmaster mail address have been saved from previous configuration', 'in include/mysql.inc.php, before
?>
insert
define(\'PHPWG_INSTALLED\', true);
'
  
  );

?>