Get upgrade to work for a postgres database, also fixes a bug in manageaccount for non admin users, a=chris
Get upgrade to work for a postgres database, also fixes a bug in manageaccount for non admin users, a=chris
diff --git a/lib/upgrade_functions.php b/lib/upgrade_functions.php
index 1a2b0eedb..fe2ac3a95 100644
--- a/lib/upgrade_functions.php
+++ b/lib/upgrade_functions.php
@@ -601,7 +601,8 @@ function upgradeDatabaseVersion20(&$db)
$profile_model = new ProfileModel(DB_NAME, false);
$profile_model->db = $db;
$save_tables = array("ACTIVE_FETCHER", "CURRENT_WEB_INDEX",
- "FEED_ITEM", "MACHINE", "MEDIA_SOURCE", "SUBSEARCH");
+ "FEED_ITEM", "MACHINE", "MEDIA_SOURCE", "SUBSEARCH",
+ "VERSION");
$dbinfo = array("DBMS" => DBMS, "DB_HOST" => DB_HOST,
"DB_USER" => DB_USER, "DB_PASSWORD" => DB_PASSWORD,
"DB_NAME" => DB_NAME);
@@ -687,6 +688,8 @@ function upgradeDatabaseVersion20(&$db)
$user['PASSWORD'] = $v20check;
$user["ZKP_PASSWORD"] = $zkp_password;
$user_model->updateUser($user);
+ $db->execute("DELETE FROM VERSION WHERE ID < 19");
+ $db->execute("UPDATE VERSION SET ID=20 WHERE ID=19");
return;
}
$data['SCRIPT'] = "doMessage('<h1 class=\"red\" >".
diff --git a/models/profile_model.php b/models/profile_model.php
index 67e973058..66074201d 100755
--- a/models/profile_model.php
+++ b/models/profile_model.php
@@ -460,8 +460,8 @@ EOT;
$dbinfo[$field] = constant($field);
}
}
- $host = str_ireplace("dbname=".$dbinfo['DB_NAME'],"",
- $dbinfo['DB_HOST']); // to get rid of database from dsn postgres
+ $host = $dbinfo['DB_HOST'];
+ // for postgress database needs to already exists
$host = str_ireplace("database=".$dbinfo['DB_NAME'],"",
$host); // informix, ibm (use connection string DSN)
$host = str_replace(";;",";", $host);
diff --git a/views/elements/manageaccount_element.php b/views/elements/manageaccount_element.php
index 90c1a1363..8e020e718 100755
--- a/views/elements/manageaccount_element.php
+++ b/views/elements/manageaccount_element.php
@@ -155,7 +155,7 @@ class ManageaccountElement extends Element
<p>[<a href="<?php e($settings_url); ?>"><?php
e(tl('manageaccount_element_search_lang_settings')); ?></a>]</p>
<?php
- if(isset($data['CRAWL_MANAGER'])) {
+ if(isset($data['CRAWL_MANAGER']) && $data['CRAWL_MANAGER']) {
?>
<h2><?php
e(tl('manageaccount_element_crawl_and_index')); ?></h2>
diff --git a/views/elements/security_element.php b/views/elements/security_element.php
index 90cf26c63..d09eee789 100755
--- a/views/elements/security_element.php
+++ b/views/elements/security_element.php
@@ -118,6 +118,9 @@ class SecurityElement extends Element
</div>
<?php
}
+ ?>
+ </div>
+ <?php
}
}