[go: up one dir, main page]

Menu

[r3]: / doc / scripts / reindex.php  Maximize  Restore  History

Download this file

87 lines (60 with data), 2.3 kB

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/local/bin/php
<?
/********************************************************
This file will reindex your files stored in
docmgr. Please set your dirPath below
and run this script at the command line
by typing "php reindex.php".
*********************************************************/
die("You must comment me out first\n");
//path to docmgr data directory
$dirPath = "/www/doc";
/*********************************************************
don't modify anything below this line
*********************************************************/
define("ALT_FILE_PATH",$dirPath);
//include our config file
include($dirPath."/config/config.php");
include($dirPath."/config/app-config.php");
include($dirPath."/header/callheader.php");
//set our path defines
$filePath = getFilePath(FILE_DIR,$dirPath);
define("ALT_FILE_PATH",$dirPath);
define("DATA_DIR",$filePath."/data");
define("TMP_DIR",$filePath."/tmp");
define("DOC_DIR",$filePath."/document");
define("THUMB_DIR",$filePath."/thumbnails");
define("PREVIEW_DIR",$filePath."/preview");
include($dirPath."/app/common.inc.php");
include($dirPath."/app/object.inc.php");
include($dirPath."/app/index_function.inc.php");
$siteModArr = loadSiteStructure($dirPath."/modules/center/");
$_SESSION["siteModList"] = $siteModArr["list"];
$_SESSION["siteModInfo"] = $siteModArr["info"];
//configure DocMGR to use avail external apps
setExternalApps();
loadObjects();
$conn = db_connect(DBHOST,DBUSER,DBPASSWORD,DBPORT,DBNAME);
if ($argc > 1) {
echo "Reindexing object ".$argv[1]."\n";
//clear our our current index
$sql = "DELETE FROM dm_index WHERE object_id='".$argv[1]."'";
db_query($conn,$sql);
$sql = "SELECT * FROM dm_object WHERE id='".$argv[1]."'";
$list = total_result($conn,$sql);
} else {
//clear our our current index
$sql = "DELETE FROM dm_index";
db_query($conn,$sql);
$sql = "SELECT * FROM dm_object";
$list = total_result($conn,$sql);
}
$num = count($list["id"]);
for ($row=0;$row<$num;$row++) {
$obj = $list["id"][$row];
$name = $list["name"][$row];
echo "Now adding \"".$name."\" to the queue\n";
indexObject($conn,$obj,0);
}
if (defined("DISABLE_BACKINDEX")) echo "Reindexing complete\n";
else echo "All files have been added to the queue. The indexing process will be complete when docmgr-indexer.php is no longer running\n";