['.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; 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);' ); ?>