diff --git a/phpgwapi/setup/tables_update_1_4.inc.php b/phpgwapi/setup/tables_update_1_4.inc.php index 2ba3866a58..cbee8a1dfc 100644 --- a/phpgwapi/setup/tables_update_1_4.inc.php +++ b/phpgwapi/setup/tables_update_1_4.inc.php @@ -92,21 +92,27 @@ $test[] = '1.5.003'; function phpgwapi_upgrade1_5_003() { // import the current egw_vfs into egw_sqlfs - // ToDo: moving /infolog and /infolog/$app to /apps in the files dir!!! $debug = $GLOBALS['DEBUG']; - // delete the table in case this update runs multiple times - $GLOBALS['egw_setup']->db->query('DELETE FROM egw_sqlfs',__LINE__,__FILE__); - if ($GLOBALS['egw_setup']->db->Type == 'mysql') - { - $GLOBALS['egw_setup']->db->query('ALTER TABLE egw_sqlfs AUTO_INCREMENT=1',__LINE__,__FILE__); - } // make sure the required dirs are there and have the following id's $dirs = array( '/' => 1, '/home' => 2, '/apps' => 3, ); + + // delete the table in case this update runs multiple times + $GLOBALS['egw_setup']->db->query('DELETE FROM egw_sqlfs',__LINE__,__FILE__); + + if ($GLOBALS['egw_setup']->db->Type == 'mysql') + { + $GLOBALS['egw_setup']->db->query('ALTER TABLE egw_sqlfs AUTO_INCREMENT=1',__LINE__,__FILE__); + } + elseif ( $GLOBALS['egw_setup']->db->Type == 'pgsql' ) + { + $GLOBALS['egw_setup']->db->query('ALTER SEQUENCE egw_sqlfs_fs_id_seq RESTART WITH '.(count($dirs) + 1),__LINE__,__FILE__); + } + foreach($dirs as $path => $id) { $nrow = array( @@ -127,7 +133,8 @@ function phpgwapi_upgrade1_5_003() ); $GLOBALS['egw_setup']->db->insert('egw_sqlfs',$nrow,false,__LINE__,__FILE__,'phpgwapi'); } - $query = $GLOBALS['egw_setup']->db->select('egw_vfs','*',"vfs_mime_type != 'journal' AND vfs_mime_type != 'journal-deleted'",__LINE__,__FILE__,false,'ORDER BY length(vfs_directory) ASC','phpgwapi'); + + $query = $GLOBALS['egw_setup']->db->select('egw_vfs','*',"vfs_mime_type != 'journal' AND vfs_mime_type != 'journal-deleted'",__LINE__,__FILE__,false,'ORDER BY vfs_file_id ASC','phpgwapi'); if ($debug) echo "rows=
\n";
 
 	foreach($query as $row)