Page 7 of 7

Re: Automatic import

PostPosted:Wed Feb 06, 2013 8:31 pm
by tymanthius1
The auto import scripts here, will they do something like this:

My wife is a teacher, and keeps hundreds of documents in a folder structure several levels deep, they don't move, usually, but they sometimes get updated. Can I have the script watch her root folder, and automagically import ONLY what has changed since the last scan?

If that can be done, I'm in love. :)

Re: Automatic import

PostPosted:Thu Feb 07, 2013 6:57 pm
by jllort
You need metadata to store lastModified date by document, and for each document compare local lastModified date than stored in openkm. If you got a lot of documents will take some time to analyze it. But is possible take a look in java how to get last modified date.

Re: Automatic import

PostPosted:Thu Feb 07, 2013 7:03 pm
by tymanthius1
Ok, I can work on that later, as it's not as important.

What about importing the new stuff as it pops in? That's MUCH more important, as most of the info is static, once done.

Re: Automatic import

PostPosted:Sat Feb 09, 2013 9:09 am
by jllort
I do not understand what you're talking about, an example is welcome.

Re: Automatic import

PostPosted:Sat Feb 09, 2013 3:33 pm
by tymanthius1
What I want is a directory structure, that my wife uses to save documents, to be periodically scanned, and import new documents to openkm. Other than importing, I don't want those documents moved, or changed.

Wikk these scripts do that?

Re: Automatic import

PostPosted:Sun Feb 10, 2013 5:29 pm
by jllort
No exactly but could do with minimal changes. At wiki there're some script which add documents and store metadata with minimal changes you could get something similar.

Recursive importing folder and synch with OpenKM folder structure based on lastModified document date and metadata lastModified date. The only case will not be covered will be when you move folders and documents into. We're finishing desktop sync ( folders synch between openkm and local directories but probably this tool will only be able for professional edition, I'm not sure at the moment ).

Re: Automatic import

PostPosted:Wed Apr 24, 2013 6:39 am
by joako
I found the script I posted in 2011[1] is not working with OpenKM 6. I have modified the script and this appears to be working in my initial tests with OpenKM 6.2.3.
Code: Select all
<?php
$okmurl="http://192.168.3.126:8080/OpenKM/";
$okmid="okmAdmin";
$okmpw="admin";
$impfile = $argv[1];
$filename =  $argv[2];
$folder =  $argv[3];

  // Register WSDL
  $OKMAuth = new SoapClient($okmurl."services/OKMAuth?wsdl");
  $OKMDocument = new SoapClient($okmurl."services/OKMDocument?wsdl");
  $OKMProperty = new SoapClient($okmurl."services/OKMProperty?wsdl");
  $OKMRepository = new SoapClient($okmurl."services/OKMRepository?wsdl");
  $file = $impfile;

  // Login
  $loginResp = $OKMAuth->login(array('user' => $okmid, 'password' => $okmpw));
  $token = $loginResp->return;
  echo "Token: ".$token."<br>";

  // Create document
  $createResp = $OKMDocument->createSimple(array('token' => $token, 'docPath' => "/okm:root/$folder/$filename", 'content' => file_get_contents($file)));
  $newDoc = $createResp->return;
  echo "[DOCUMENT] Path: ".$newDoc->path.", Author: ".$newDoc->author.", Size: ".$newDoc->actualVersion->size."<br>";

  // Category assign
  //$getNodeUuid = $OKMRepository->getNodeUuid(array('token' => $token, 'path' => '/okm:categories/alfa'));
  //$catId = $getNodeUuid->return;
  //$OKMProperty->addCategory(array('token' => $token, 'nodePath' => $newDoc->path, 'catId' => $catId));

  // Logout
  $OKMAuth->logout($token);
?>
[1] http://forum.openkm.com/viewtopic.php?f ... =60#p12456

Re: Automatic import

PostPosted:Fri Apr 26, 2013 9:51 am
by pavila
Which is the problem? Any error or exception?

Re: Automatic import

PostPosted:Tue Apr 30, 2013 6:54 am
by joako
pavila wrote:Which is the problem? Any error or exception?
Sorry I don't really recall. Since I saw in another post that the code for 6.x was not the same for 5.x I didn't focus on that and just worked with the new 6.x code in the Wiki.

Re: Automatic import

PostPosted:Sat Sep 21, 2013 7:25 am
by kknd
jllort wrote:No exactly but could do with minimal changes. At wiki there're some script which add documents and store metadata with minimal changes you could get something similar.

Recursive importing folder and synch with OpenKM folder structure based on lastModified document date and metadata lastModified date. The only case will not be covered will be when you move folders and documents into. We're finishing desktop sync ( folders synch between openkm and local directories but probably this tool will only be able for professional edition, I'm not sure at the moment ).
The OpenKM Sync is a great feature ! Some great !
¿Cuándo estará disponible? please for CM version :D

EDIT: sorry i see now the link :D

http://www.openkm.com/download/desktops ... %206.2.zip

tksssss

Re: Automatic import

PostPosted:Sat Sep 21, 2013 8:34 am
by jllort
Early we will release new version of OpenKM desktop sync to correct some minimal bugs we've found. Anyway do not worry with actual version these are minimal corrections of cases we've found where not take in consideration by logic.

Re: Automatic import

PostPosted:Sat Jul 30, 2022 3:55 am
by scrumi
jllort wrote: Fri Jan 25, 2013 8:49 am I have added here http://wiki.openkm.com/index.php/Utilities with name Crontab simple importer
I'm trying to use this, but it is throwing an error:
Code: Select all
2022-07-29 20:54:08,193 [http-nio-0.0.0.0-8080-exec-15] [] WARN  com.openkm.core.Cron - Error executing crontab task 'Billing Import': bsh.EvalError: Sourced file: inline evaluation of: ``import com.openkm.core.*; import com.openkm.api.*; import java.io.*; import com. . . . '' : The collection, array, map, iterator, or enumeration portion of a for statement cannot be null. : at Line: 13 : in file: inline evaluation of: ``import com.openkm.core.*; import com.openkm.api.*; import java.io.*; import com. . . . '' : for ( File file : fldpath .listFiles ( ) ) {

2022-07-29 20:54:08,198 [http-nio-0.0.0.0-8080-exec-15] [] WARN  com.openkm.core.Cron - Error sending mail: Sourced file: inline evaluation of: ``import com.openkm.core.*; import com.openkm.api.*; import java.io.*; import com. . . . '' : The collection, array, map, iterator, or enumeration portion of a for statement cannot be null. : at Line: 13 : in file: inline evaluation of: ``import com.openkm.core.*; import com.openkm.api.*; import java.io.*; import com. . . . '' : for ( File file : fldpath .listFiles ( ) ) {
Any ideas?

Re: Automatic import

PostPosted:Mon Aug 01, 2022 7:19 am
by scrumi
Turns out this was just a file permissions issue. Nothing really related to openKM at all.