From 79c440d8bbd9c36778d421e6348fa43091efaadf Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 6 Jan 2005 22:16:21 +0000 Subject: - upgrade scripts added for releases 1.3.x - my_error function moved from admin/include/functions.php to include/functions.inc.php - because MySQL temporary tables are not always authorized on creation, use a temporary table name (with the current microsecond) on a non temporary table (in mass_updates function) - ability to retrieve distant full directories (usefull in upgrade scripts) - global variables $count_queries and $queries_time moved into global array $page - get_cat_display_name displays category names in correct order : the one given by uppercats - function setup_style simplified - default value for configuration parameter "show_nb_comments" set to false (less queries by default) git-svn-id: http://piwigo.org/svn/trunk@672 68402e56-0260-453c-a942-63ccdbb3a9ee --- install/upgrade_1.3.2.php | 362 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 362 insertions(+) create mode 100644 install/upgrade_1.3.2.php (limited to 'install/upgrade_1.3.2.php') diff --git a/install/upgrade_1.3.2.php b/install/upgrade_1.3.2.php new file mode 100644 index 000000000..179324265 --- /dev/null +++ b/install/upgrade_1.3.2.php @@ -0,0 +1,362 @@ +['.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);
'
+  
+  );
+
+?>
\ No newline at end of file
-- 
cgit v1.2.3