22 include_once (
"FDL/Class.Doc.php");
23 include_once (
"FDL/Class.SearchDoc.php");
26 if ($msg) $msg = chr(0x1b) .
"[1;31m" . $msg . chr(0x1b) .
"[0;39m";
32 if ($msg) $msg = chr(0x1b) .
"[1;32m" . $msg . chr(0x1b) .
"[0;39m";
38 if ($msg) $msg = chr(0x1b) .
"[1;33m" . $msg . chr(0x1b) .
"[0;39m";
43 $usage->setText(
"Refresh documents ");
44 $famId =
$usage->addNeeded(
"famid",
"the family identificator used to filter");
45 $method =
$usage->addOption(
"method",
"method to use)", array() ,
"refresh");
46 $arg =
$usage->addOption(
"arg",
"optional method argument to set when calling method");
51 $docid =
$usage->addOption(
"docid",
"use only for this document id");
52 $start =
$usage->addOption(
"start",
"start from offset", array() , 0);
53 $slice =
$usage->addOption(
"slice",
"limit from offset", array() ,
"all");
54 $fldid =
$usage->addOption(
"fldid",
"use collection id to limit search");
66 print
"Database not found : param FREEDOM_DB";
76 if ($f->doctype !=
'C') {
77 $action->exitError(sprintf(
"document %s not a family",
$famId));
84 $s->setObjectReturn();
85 $s->orderby =
'id desc';
93 $action->exitError(sprintf(
"document with name '%s' not found", $docName));
105 $action->exitError(sprintf(
"filter not valid :%s", pg_last_error()));
112 if (
$s->searchError()) {
113 $action->exitError(sprintf(
"search error : %s",
$s->getError()));
121 while (
$doc =
$s->nextDoc()) {
124 printf(
"\nmethod not exists %s \n",
$method);
127 $doc->_oldvalue = array();
131 $ret = call_user_func_array(array(
135 if (
$doc->isChanged()) {
136 $olds =
$doc->getOldValues();
137 foreach ($olds as $k => $v) {
138 $smod.= sprintf(
"\t- %s [%s]:[%s]\n", $k, $v,
$doc->getValue($k));
157 if ($smod) print $smod;