source: trunk/admin/include/functions_upgrade.php @ 2104

Last change on this file since 2104 was 2104, checked in by rub, 17 years ago

Resolved 0000748: Name configuration of all the tables

New method of implementation!

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2007-09-21 21:23:09 +0000 (Fri, 21 Sep 2007) $
10// | last modifier : $Author: rub $
11// | revision      : $Revision: 2104 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28function check_upgrade()
29{
30  // Is PhpWebGallery already installed ?
31  if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
32  {
33    $message = 'PhpWebGallery is not in upgrade mode. In include/mysql.inc.php,
34insert line
35<pre style="background-color:lightgray">
36define(\'PHPWG_IN_UPGRADE\', true);
37</pre>
38if you want to upgrade';
39    die($message);
40  }
41}
42
43// concerning upgrade, we use the default tables
44function prepare_conf_upgrade()
45{
46  global $prefixeTable;
47
48  // $conf is not used for users tables
49  // define cannot be re-defined
50  define('CATEGORIES_TABLE', $prefixeTable.'categories');
51  define('COMMENTS_TABLE', $prefixeTable.'comments');
52  define('CONFIG_TABLE', $prefixeTable.'config');
53  define('FAVORITES_TABLE', $prefixeTable.'favorites');
54  define('GROUP_ACCESS_TABLE', $prefixeTable.'group_access');
55  define('GROUPS_TABLE', $prefixeTable.'groups');
56  define('HISTORY_TABLE', $prefixeTable.'history');
57  define('HISTORY_SUMMARY_TABLE', $prefixeTable.'history_summary');
58  define('IMAGE_CATEGORY_TABLE', $prefixeTable.'image_category');
59  define('IMAGES_TABLE', $prefixeTable.'images');
60  define('SESSIONS_TABLE', $prefixeTable.'sessions');
61  define('SITES_TABLE', $prefixeTable.'sites');
62  define('USER_ACCESS_TABLE', $prefixeTable.'user_access');
63  define('USER_GROUP_TABLE', $prefixeTable.'user_group');
64  define('USERS_TABLE', $prefixeTable.'users');
65  define('USER_INFOS_TABLE', $prefixeTable.'user_infos');
66  define('USER_FEED_TABLE', $prefixeTable.'user_feed');
67  define('WAITING_TABLE', $prefixeTable.'waiting');
68  define('RATE_TABLE', $prefixeTable.'rate');
69  define('USER_CACHE_TABLE', $prefixeTable.'user_cache');
70  define('USER_CACHE_CATEGORIES_TABLE', $prefixeTable.'user_cache_categories');
71  define('CADDIE_TABLE', $prefixeTable.'caddie');
72  define('UPGRADE_TABLE', $prefixeTable.'upgrade');
73  define('SEARCH_TABLE', $prefixeTable.'search');
74  define('USER_MAIL_NOTIFICATION_TABLE', $prefixeTable.'user_mail_notification');
75  define('TAGS_TABLE', $prefixeTable.'tags');
76  define('IMAGE_TAG_TABLE', $prefixeTable.'image_tag');
77  define('PLUGINS_TABLE', $prefixeTable.'plugins');
78  define('WEB_SERVICES_ACCESS_TABLE', $prefixeTable.'ws_access');
79  define('OLD_PERMALINKS_TABLE', $prefixeTable.'old_permalinks');
80}
81
82// Create empty local files to avoid log errors
83function create_empty_local_files() 
84{
85   $files = 
86      array (
87         PHPWG_ROOT_PATH . 'template-common/local-layout.css',
88         PHPWG_ROOT_PATH . 'template/yoga/local-layout.css'
89         );
90
91   foreach ($files as $path)
92   {
93      if (!file_exists ($path))
94      {
95         $file = @fopen($path, "w");
96         @fwrite($file , '/* You can modify this file */');
97         @fclose($file);
98      }
99   }
100}
101
102?>
Note: See TracBrowser for help on using the repository browser.