Bugfixes beim Webapp-installer
bernd

bernd commited on 2009-07-16 09:17:07
Zeige 2 geänderte Dateien mit 14 Einfügungen und 6 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1414 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -59,6 +59,9 @@ foreach ($results AS $app) {
59 59
     $up = upgradeable($app['appname'], $app['version']);
60 60
     if ($up)
61 61
     {
62
+      if (directory_in_use($app['directory']))
63
+        output('<p><em>Automatische Update-Aktion heute nicht mehr möglich</em></p>');
64
+      else
62 65
         output('<p>'.internal_link('requestupdate', 'Update automatisch durchführen', "dir={$app['directory']}&app={$up}")."</p>\n");
63 66
     }
64 67
   }
... ...
@@ -5,13 +5,13 @@ require_once('inc/base.php');
5 5
 function create_new_webapp($appname, $directory, $url, $data)
6 6
 {
7 7
   if (directory_in_use($directory))
8
-    system_failure('Sie haben erst kürzlich eine Anwendung in diesem Verzeichnis installieren lassen. Die Installation ist noch nicht beendet.');
8
+    system_failure('Sie haben erst kürzlich eine Anwendung in diesem Verzeichnis installieren lassen. Aus Sicherheitsgründen können Sie in diesem Verzeichnis am selben Tag nicht schon wieder eine Anwendung installieren.');
9 9
   $username = mysql_real_escape_string($_SESSION['userinfo']['username']);
10 10
   $appname = mysql_real_escape_string($appname);
11 11
   $directory = mysql_real_escape_string($directory);
12 12
   $url = mysql_real_escape_string($url);
13 13
   $data = mysql_real_escape_string($data);
14
-  db_query("INSERT INTO vhosts.webapp_installer VALUES (NULL, '{$appname}', '{$directory}', '{$url}', 'new', '{$username}', '{$data}')");
14
+  db_query("INSERT INTO vhosts.webapp_installer (appname, directory, url, state, username, data) VALUES ('{$appname}', '{$directory}', '{$url}', 'new', '{$username}', '{$data}')");
15 15
 }
16 16
 
17 17
 
... ...
@@ -23,13 +23,13 @@ function request_update($appname, $directory, $url)
23 23
   $appname = mysql_real_escape_string($appname);
24 24
   $directory = mysql_real_escape_string($directory);
25 25
   $url = maybe_null(mysql_real_escape_string($url));
26
-  db_query("INSERT INTO vhosts.webapp_installer VALUES (NULL, '{$appname}', '{$directory}', {$url}, 'old', '{$username}', NULL)");
26
+  db_query("INSERT INTO vhosts.webapp_installer (appname, directory, url, state, username) VALUES ('{$appname}', '{$directory}', {$url}, 'old', '{$username}')");
27 27
 }
28 28
 
29 29
 function directory_in_use($directory)
30 30
 {
31 31
   $directory = mysql_real_escape_string($directory);
32
-  $result = db_query("SELECT id FROM vhosts.webapp_installer WHERE state IN ('new','old') AND directory='{$directory}'");
32
+  $result = db_query("SELECT id FROM vhosts.webapp_installer WHERE (state IN ('new','old') OR DATE(lastchange)=CURDATE()) AND directory='{$directory}'");
33 33
   if (mysql_num_rows($result) > 0)
34 34
     return true;
35 35
   return false;
... ...
@@ -48,6 +48,11 @@ function upgradeable($appname, $version)
48 48
     }
49 49
     DEBUG("Version: ".substr($version, 0, 2));
50 50
   }
51
+  elseif ($appname == 'MediaWiki')
52
+  {
53
+    DEBUG("found MediaWiki");
54
+    return 'mediawiki';
55
+  }
51 56
   DEBUG("found no upgradeable webapp!");
52 57
   return NULL;
53 58
 }
... ...
@@ -98,8 +103,8 @@ function create_webapp_mysqldb($application, $sitename)
98 103
     $handle = $username.'_'.$i;
99 104
     if (validate_mysql_username($handle) && validate_mysql_dbname($handle) && ! (has_mysql_user($handle) || has_mysql_database($handle)))
100 105
     {
101
-      create_mysql_database($handle);
102
-      create_mysql_account($handle);
106
+      create_mysql_database($handle, $description);
107
+      create_mysql_account($handle, $description);
103 108
       set_mysql_access($handle, $handle, true);
104 109
       $password = random_string(10);
105 110
       set_mysql_password($handle, $password);
106 111