Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
FullFileIndex.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Detect file which are not indexed and index them
8  *
9  * @author Anakeen
10  * @version $Id: FullFileIndex.php,v 1.2 2007/09/07 09:40:21 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ('FDL/Class.Doc.php');
18 include_once ("FDL/Lib.Dir.php");
19 global $action;
20 
21 define("REDCOLOR", "\033" . '[1;31;40m');
22 define("UPDTCOLOR", "\033" . '[1;32;40m');
23 define("STOPCOLOR", "\033" . '[0m');
24 
25 $usage = new ApiUsage();
26 
27 $usage->setDefinitionText("Detect file which are not indexed and index them");
28 $force = ($usage->addOptionalParameter("force", "force (yes or no)") == "yes");
29 
30 $usage->verify();
31 
32 $dbaccess = $action->dbaccess;
33 if ($dbaccess == "") {
34  print "Database not found : action->dbaccess";
35  exit;
36 }
38 $q = new QueryDb($dbaccess, "DocAttr");
39 $q->AddQuery("type = 'file'");
40 $q->AddQuery("usefor != 'Q'");
41 //$q->AddQuery("frameid not in (select id from docattr where type~'array')");
42 $la = $q->Query(0, 0, "TABLE");
43 
44 foreach ($la as $k => $v) {
45  $docid = $v["docid"];
46  $aid = $v["id"];
47 
48  $filter = array();
49  $filter[] = "$aid is not null";
50  if (!$force) $filter[] = "{$aid}_txt is null";
51  $ldoc = internalGetDocCollection($dbaccess, 0, 0, "ALL", $filter, $action->user->id, "ITEM", $docid);
52  $c = countDocs($ldoc);
53 
54  print "\n-- Family $docid, Attribute : $aid, count:$c\n";
55  while ($doc = getNextDoc($dbaccess, $ldoc)) {
56  print "$c)" . $doc->title . "- $aid -" . $doc->id . '- ' . $doc->fromid . "\n";
57  $c--;
58  $err = $doc->recomputeTextFiles($aid);
59  if ($err) print REDCOLOR . $err . STOPCOLOR;
60  }
61 }
62 //print "$sqlicon\n";
$force
getNextDoc($dbaccess, &$tres)
global $action
$dbaccess
const STOPCOLOR
$docid
Definition: cleanFamily.php:13
countDocs(&$tres)
internalGetDocCollection($dbaccess, $dirid, $start="0", $slice="ALL", $sqlfilters=array(), $userid=1, $qtype="LIST", $fromid="", $distinct=false, $orderby="title", $latest=true, $trash="", &$debug=null, $folderRecursiveLevel=2, $join= '',\SearchDoc &$searchDoc=null)
Definition: Lib.Dir.php:428
const REDCOLOR
print
Definition: checklist.php:49
if($dbaccess=="") $o
switch($command) exit
Definition: checkVault.php:46
if($file) if($subject==""&&$file) if($subject=="") $err
$usage
Verify arguments for wsh programs.
← centre documentaire © anakeen