-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Egil Moeller
committed
Sep 16, 2011
1 parent
a017db7
commit c196016
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import("etherpad.log"); | ||
import("dispatch.{Dispatcher,PrefixMatcher,forward}"); | ||
import("sqlbase.sqlobj"); | ||
import("etherpad.collab.server_utils"); | ||
import("etherpad.utils"); | ||
import("etherpad.pad.padutils"); | ||
import("fastJSON"); | ||
|
||
function padModelWriteToDB(args) { | ||
var old = sqlobj.selectSingle("PAD_FULLTEXT", { PAD_ID: args.padId }); | ||
if (old !== null) { | ||
sqlobj.update("PAD_FULLTEXT", {PAD_ID: args.padId }, {TEXT: args.pad.text()}); | ||
} else { | ||
sqlobj.insert("PAD_FULLTEXT", {PAD_ID: args.padId, TEXT: args.pad.text()}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import("etherpad.log"); | ||
import("plugins.fullTextSave.hooks"); | ||
import("sqlbase.sqlobj"); | ||
import("sqlbase.sqlcommon"); | ||
|
||
function fullTextSaveInit() { | ||
this.hooks = ['padModelWriteToDB']; | ||
this.description = 'Saves a full text copy of the latest version of a pad for external search tools (e.g. lucene)'; | ||
this.padModelWriteToDB = hooks.padModelWriteToDB; | ||
|
||
this.install = install; | ||
this.uninstall = uninstall; | ||
} | ||
|
||
function install() { | ||
log.info("Installing fullTextSave"); | ||
|
||
sqlobj.createTable('PAD_FULLTEXT', { | ||
PAD_ID: 'varchar(128) character set utf8 collate utf8_bin not null references PAD_META(ID)', | ||
TEXT: 'text collate utf8_bin not null' | ||
}); | ||
|
||
} | ||
|
||
function uninstall() { | ||
log.info("Uninstalling fullTextSave"); | ||
} | ||
|