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

Last change on this file since 2299 was 2299, checked in by plg, 16 years ago

Bug fixed: as rvelices notified me by email, my header replacement script was
bugged (r2297 was repeating new and old header).

By the way, I've also removed the replacement keywords. We were using them
because it was a common usage with CVS but it is advised not to use them with
Subversion. Personnaly, it is a problem when I search differences between 2
Piwigo installations outside Subversion.

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