aboutsummaryrefslogtreecommitdiffstats
path: root/etherpad/src/plugins/urlIndexer/main.js
blob: 0b2847fc13afda527d5ce77fdc2d182a455a896e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import("etherpad.log");
import("plugins.urlIndexer.hooks");
import("sqlbase.sqlobj");
import("sqlbase.sqlcommon");

function init() {
 this.hooks = ['padModelWriteToDB', 'handlePath'];
 this.description = 'Indexes URLs linked to in pads so that they can be displayed outside pads, searched for etc.';
 this.padModelWriteToDB = hooks.padModelWriteToDB;
 this.handlePath = hooks.handlePath;

 this.install = install;
 this.uninstall = uninstall;
}

function install() {
 log.info("Installing urlIndexer");

 sqlobj.createTable('PAD_URL', {
   PAD_ID: 'varchar(128) character set utf8 collate utf8_bin not null references PAD_META(ID)',
   URL: 'varchar(1024) character set utf8 collate utf8_bin not null',
  });

 sqlobj.createTable('PAD_URL_CACHE', {
   PAD_ID: 'varchar(128) character set utf8 collate utf8_bin unique not null references PAD_META(ID)',
   URLS: 'text collate utf8_bin not null',
  });
}

function uninstall() {
 log.info("Uninstalling urlIndexer");
}