X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter2.3.php;h=053fa02568d01d96d2a09ce7c560b594a613211b;hb=f36d4241ba673261532a1bb3c59b6b985901238e;hp=fe455bfb4874a165fd9a4fa0c831528dd7208ba7;hpb=b9185a0190595e671a9750eb4e9f8e0bd6c713f9;p=fa-stable.git diff --git a/sql/alter2.3.php b/sql/alter2.3.php index fe455bfb..053fa025 100644 --- a/sql/alter2.3.php +++ b/sql/alter2.3.php @@ -18,6 +18,7 @@ class fa2_3 { function fa2_3() { $this->description = _('Upgrade from version 2.2 to 2.3'); + $this->preconf = $this->fix_extensions(); } // @@ -28,6 +29,9 @@ class fa2_3 { { global $core_version; + if (!$this->preconf) + return false; + if (!$this->beta) { // all specials below are already done on 2.3beta @@ -257,6 +261,91 @@ class fa2_3 { } return true; } + + function fix_extensions() + { + global $path_to_root, $next_extension_id, $installed_languages; + + $lang_chd = false; + foreach($installed_languages as $i => $lang) { + if (!isset($lang['path'])) { + $installed_languages[$i]['path'] = 'lang/'.$code; + $installed_languages[$i]['package'] = 'lang/'.$code; + $lang_chd = true; + } + } + if ($lang_chd) + write_lang(); + + $installed_extensions= get_company_extensions(); + + if (!isset($next_extension_id)) + $next_extension_id = 1; + $new_exts = array(); + + foreach($installed_extensions as $i => $ext) + { + if (isset($ext['title'])) // old type entry + { + if ($ext['type'] == 'module') + $new['type'] = 'extension'; + $new['tabs'][] = array( + 'url' => $ext['filename'], + 'access' => isset($ext['access']) ? $ext['access'] : 'SA_OPEN', + 'tab_id' => $ext['tab'], + 'title' => $ext['title'] + ); + $new['path'] = $ext['path']; + } + else // plugin + { + $new['type'] = 'extension'; + $new['tabs'] = array(); + $new['path'] = 'modules/'.$ext['path']; + $new['entries'][] = array( + 'url' => $ext['filename'], + 'access' => isset($ext['access']) ? $ext['access'] : 'SA_OPEN', + 'tab_id' => $ext['tab'], + 'title' => $ext['title'] + ); + } + if (isset($ext['acc_file'])) + $new['acc_file'] = $ext['acc_file']; + $new['name'] = $ext['name']; // albo access_string(title) + $new['package'] = $new['package'] = ''; + $new['active'] = 1; + + $new_exts[$i] = $new; + } + } + // Add non-standard themes + $path = $path_to_root.'/themes/'; + $themes = array(); + $themedir = opendir($path); + while (false !== ($fname = readdir($themedir))) + { + if ($fname!='.' && $fname!='..' && $fname!='CVS' && is_dir($path.$fname) + && !in_array($fname, array('aqua', 'cool', 'default'))) + { + foreach($installed_extensions as $ext) + if ($ext['path'] == 'themes/'.$fname) // skip if theme is already listed + continue 2; + $new_exts[$next_extension_id++] = array( + 'name' => 'Theme '. ucwords($fname), + 'package' => $fname, + 'type' => 'theme', + 'active' => true, + 'path' => 'themes/'.$fname + ); + } + } + closedir($themedir); + + if (count($new_exts)) { + return update_extensions($new_exts); + } else + return true; + } } $install = new fa2_3;