]> dev.renevier.net Git - syp.git/blob - inc/html/upgrade.php
postgresql support
[syp.git] / inc / html / upgrade.php
1 <?php
2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
3    license. */
4     if (!@include_once ("./inc/settings.php")) {
5         header ('Location: install.php');
6     }
7 ?>
8 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
9        "http://www.w3.org/TR/html4/loose.dtd">  
10 <html lang="<?php echo $lang?>">
11 <head>
12       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
13       <link rel="stylesheet" href="./media/common.css" type="text/css" >
14       <title><?php ptrans ('SYP upgrade')?></title>
15 </head>
16 <body>
17 <?php
18     function create_all_thumbs($con) {
19         $features = $con->listfeatures ();
20         foreach ($features as $feature) {
21             if ($feature->imgpath) {
22                 $imgfilename = UPLOADDIR . "/" . $feature->imgpath;
23                 $thumbfilename = getthumbsdir () .  "/mini_" . $feature->imgpath;
24                 if ((file_exists ($imgfilename)) && 
25                     (!(file_exists ($thumbfilename)))) {
26                         create_thumbnail_or_copy ($imgfilename, $thumbfilename);
27                 }
28             }
29         }
30         return true;
31     }
32
33     require_once ("./inc/db/" . (defined ("DBTYPE")? DBTYPE: "mysql") . ".php");
34     require_once ("./inc/install_utils.php");
35     require_once ("./inc/utils.php");
36
37     $error = false;
38     try {
39         $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
40         $usrtblexists = $connection->users_table_exists ();
41         $itemstblexists = $connection->items_table_exists ();
42     } catch (Exception $e) {
43         $error = true;
44     }
45     if (!$usrtblexists || !$itemstblexists) {
46         $error = true;
47     }
48     if ($error) {
49        die(sprintf('<p class="error center">%s</p>', trans('SYP is not correctly installed. Please follow README.txt instructions
50        and go to <a href="install.en.php">wizard</a>.')));
51     }
52
53     safe_create_writable_dir (getthumbsdir ());
54     if (create_all_thumbs ($connection)) {
55         par_success (trans('Thumbnails successfully created.'));
56     } else {
57         par_error_and_leave (trans('Error when creating thumbnails.'));
58     }
59
60     par_success (trans ('SYP upgrade went smoothly. You can now go to <a href="admin.en.php">admin area</a>'));
61
62 ?>
63 </body>
64 </html>