Fixed extension module update and deletion.
[fa-stable.git] / sql / alter2.2.php
index 457850ffc829a56a99b5b3d075718b7113a8774f..cfc914aad4293703e2b7e70907d7267e88afba1c 100644 (file)
@@ -63,7 +63,7 @@ class fa2_2 {
                        if (db_num_rows($result)) {
                                while ($row = db_fetch($result)) {
                                        $res2 = db_query("INSERT INTO {$pref}refs VALUES("
-                                               . $row['id'].",".$typeno.",'".addslashes($row['ref'])."')");
+                                               . $row['id'].",".$typeno.",".db_escape($row['ref']).")");
                                        if (!$res2) {
                                                display_error(_("Cannot copy references from $tbl")
                                                        .':<br>'. db_error_msg($db));
@@ -103,7 +103,9 @@ class fa2_2 {
                
                if ($this->beta && !$force)
                        $this->sql = 'alter2.2rc.sql';
-               return $this->beta || !check_table($pref, 'usersonline');
+               // return ok when security groups still defined (upgrade from 2.1)
+               // or usersonline not defined (upgrade from 2.2 beta)
+               return isset($security_groups) || (check_table($pref, 'usersonline')!=0);
        }
        //
        //      Test if patch was applied before.