svn commit: samba r19252 - in
branches/SAMBA_4_0/source/scripting/libjs: .
tridge at samba.org
tridge at samba.org
Thu Oct 12 08:32:58 GMT 2006
Author: tridge
Date: 2006-10-12 08:32:58 +0000 (Thu, 12 Oct 2006)
New Revision: 19252
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19252
Log:
- fixed 'erase' argument to setup_ldb()
- when wiping a ldb, wipe within each naming context first. By not
wiping the naming contexts we didn't wipe the partitions, which
caused a massive slowdown in re-provisioning due to re-indexing of
the schema.
Modified:
branches/SAMBA_4_0/source/scripting/libjs/provision.js
Changeset:
Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js 2006-10-11 21:40:07 UTC (rev 19251)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js 2006-10-12 08:32:58 UTC (rev 19252)
@@ -157,8 +157,25 @@
*/
function ldb_erase(ldb)
{
- var attrs = new Array("dn");
+ var attrs = new Array("namingContexts");
+ var res;
+ /* delete within each naming context - this copes with existing partitions */
+ res = ldb.search("objectClass=*", "", ldb.SCOPE_BASE, attrs);
+ if (typeof(res) != "undefined") {
+ if (res.length > 0) {
+ var names = res[0].namingContexts;
+ for (i=0;i<names.length;i++) {
+ attrs = new Array("dn");
+ res = ldb.search("(objectclass=*)", names[i], ldb.SCOPE_SUBTREE, attrs);
+ var j;
+ for (j=0;j<res.length;j++) {
+ ldb.del(res[j].dn);
+ }
+ }
+ }
+ }
+
/* delete the specials */
ldb.del("@INDEXLIST");
ldb.del("@ATTRIBUTES");
@@ -168,6 +185,7 @@
ldb.del("@KLUDGEACL");
/* and the rest */
+ attrs = new Array("dn");
var basedn = "";
var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
var i;
@@ -179,6 +197,7 @@
ldb.del(res[i].dn);
}
+
var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
if (res.length != 0) {
ldb_delete(ldb);
@@ -292,7 +311,7 @@
failok = arguments[4];
}
var ldb = open_ldb(info, dbname, erase);
- if (setup_add_ldif(ldif, info, ldb, erase, failok)) {
+ if (setup_add_ldif(ldif, info, ldb, failok)) {
var commit_ok = ldb.transaction_commit();
if (!commit_ok) {
info.message("ldb commit failed: " + ldb.errstring() + "\n");
More information about the samba-cvs
mailing list