Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

update file version with script failed
Last Post 08/02/2012 11:42 AM by Peter Donker. 10 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
justin
New Member
New Member
Posts:11


--
07/09/2012 7:43 PM
Hi,

I have a problem with updating file in my DMX module 5.3.9. In the DMX module,I am using source leading setting for file sync folder. If it is a new file in that folder and run script, module works fine. The file got uploaded to the site. But if I made changes to the document and try to upload to the site again with the script, it doesn't see the file has been modified at all.

I just wonder which part I am missing or I haven't paid attentions. Can you give me some help?

By the way, My dnn site is still on v5.6. probably 5.6.2

Thanks.

Justin
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/12/2012 8:15 PM
Hi Justin,

The only way DMX can determine if the source file has changed is through the Last Modified date on the file. Is this set correctly after your external edit? If so, are you in the same timezone as your server? I.e. can we rule out time zone issues?

If you examine the report after a sync (under Host > Schedule and then the history of this task) you can see mention of the time from and until it will search for changes. The file modified date has to fall in this window to be picked up. I hope this info helps debug this issue.

Peter
justin
New Member
New Member
Posts:11


--
07/18/2012 2:04 AM
Here is the log I have pulled from the module.
First part shows there is changes on the file.

734700.16:42:36.441 - Checking '\\dnnserver\Data\mybaywest_watched\dm2121\CouncilReports\OnlineLetter-1.doc'
734700.16:42:36.441 - File \\dnnserver\Data\mybaywest_watched\dm2121\CouncilReports\OnlineLetter-1.doc was modified on 2012-07-17 23:42:36Z

This part is where it failed to pick up the changes.

734700.16:42:36.441 - STEP 2: run through DMX folders and files and check with src
734700.16:42:36.441 - File Contact Sheet-dm2121.PDF exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File FS-2011-01.pdf exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter- for dm2121.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter-1.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - Recursing on 0 subfolders.

I wonder if the newer version would have fixed this bug?
justin
New Member
New Member
Posts:11


--
07/19/2012 12:44 AM
[quote]
Posted By justin on 18 Jul 2012 02:04:53
Here is the log I have pulled from the module.
First part shows there is changes on the file.

734700.16:42:36.441 - Checking '\\dnnserver\Data\mybaywest_watched\dm2121\CouncilReports\OnlineLetter-1.doc'
734700.16:42:36.441 - File \\dnnserver\Data\mybaywest_watched\dm2121\CouncilReports\OnlineLetter-1.doc was modified on 2012-07-17 23:42:36Z

This part is where it failed to pick up the changes.

734700.16:42:36.441 - STEP 2: run through DMX folders and files and check with src
734700.16:42:36.441 - File Contact Sheet-dm2121.PDF exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File FS-2011-01.pdf exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter- for dm2121.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - File OnlineLetter-1.doc exists both in DMX and src and was not modified on src.
734700.16:42:36.441 - Recursing on 0 subfolders.

I wonder if the newer version would have fixed this bug?
[/quote]
Does my post make sense? I am still waiting for a reply on this.

Thanks.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/20/2012 10:43 AM
Hi Justin,

I guess the "was modified on 2012-07-17 23:42:36Z " fell outside the sync window as mentioned right at the start of the process. In any case it decided not to do anything. From your description I gather you changed the OnlineLeter-1 document in DMX but it did not get pushed to the src, is that right?

Peter
justin
New Member
New Member
Posts:11


--
07/20/2012 7:25 PM
Peter,

No, it is opposite.
I made change to the source file in the src folder. From the log, it seemed pick up the modified date. but didn't import the file into DMX
justin
New Member
New Member
Posts:11


--
07/24/2012 12:35 AM
Peter,

The funny part I have found in the module is if the doucment in microsoft word format. The module will detect changes and import the modified file into DMX. But if I use PDF document, the module will not pick it up the changes, even the file size changed from 10k to 100k. Have you noticed that issue before?
justin
New Member
New Member
Posts:11


--
07/24/2012 12:43 AM
Peter,

with my further test and debug, I also found that module seems timed out for a while. Between this time out period, "run script" command will not sync any files in side the watched file folder. Is that an expected behavior?
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/25/2012 9:49 AM
Hi Justin,

I've never seen differences in file types. The sync logic looks purely at file write times. Maybe the client software (i.e. whatever creates/updates the PDF/Word files) does something funky.

About the timeout: I'm not entirely sure what it is you mean. The sync process as triggered by the scheduled task runs in the background. This is different from the sync process run from the script under Admin > Run Scripts. The latter uses a much bigger "window".

What I'd like to drill down to is this: the sync folder has a sync direction and every time the sync runs there is a log to show what happens. The log starts with an announcement of the "window" that is being scanned (i.e. the from and until dates). You then need to compare that window with the modified date found on the document. Finally: if the modified date is in the window *and* the sync direction is such that it will need to do something, the log should show something about what it decided: i.e. no action or importing document xyz.

What you can do is to send me a complete sync log from the scheduled task where you think there was an error.

Peter
justin
New Member
New Member
Posts:11


--
07/26/2012 1:52 AM
Thanks Peter.

This is my situatio that I am using c# command to call RunScripts on each Portal instead of using a task to sync all portals at one time. So everytime I finished running script on one portal, I found module have to wait a few minutes to be able to sync in the same portal again. That is what you meant above as "window".

my next question is whether it has a way to change the window value for my script? So I don't have to wait that long to run that script on my portal again.

Thanks.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/02/2012 11:42 AM
Hi Justin,

The run script doesn't have the ability to run a different time window. Instead you're better off calling the actual method to sync. It is like this:

1. Find out all SyncFolders in DMX. You'll need the EntryId and Entry value
2. Get the New SyncFolderAttSettings(Entry)
3. Create a New SyncFolderSynchronizer(PortalID, AdministratorId, lastSyncTime, endTime, Settings) where the AdmnistratorId is the UserId of the admin of the portal.
4. Call Run(SourceFolder, folderEntryId, True)

The API is under DMX.Services.SyncFolders. Note you will need to take care of timing yourself here. I.e. you may want to lock the folder while you're doing this. For a sync that lasts for just a few seconds you won't need to make any provisions, but if your sync lasts for 15 minutes for instance, you may get unexpected results if someone actually makes a change during that time.

Peter
You are not authorized to post a reply.