donb
committed
on 14 Jul 03
Added Malte Sussedorf...
/tcl/static-pages-procs.tcl (+2 -2)
38 38
39 39     @param folder_add_proc The name of a Tcl proc to be called for each folder
40 40                            added.  The full file path and the folder_id will be
41 41                            passed to it.
42 42
43 43     @param folder_unchanged_proc The name of a Tcl proc to be called for each folder
44 44                                  unchanged in the database.
45 45
46 46     @param fs_root The starting path in the filesystem.  Files below this point will
47 47                    be scanned.
48 48
49 49     @param root_folder_id The id of the root folder in the static-pages system (and in
50 50                           the content repository) obtained from
51 51                           <code>static_page.get_root_folder</code>.
52 52
53 53     @param static_page_regexp A regexp to identify static pages.
54 54
55 55     @author Brandoch Calef (bcalef@arsdigita.com)
56 56     @creation-date 2001-02-07
57 57 } {
58       set sync_session_id [db_nextval sp_session_id_seq]
  58     set sync_session_id [db_nextval sp_session_id_sequence]
59 59
60 60     set fs_trimmed [string trimright $fs_root "/"]
61 61     set fs_trimmed_length [string length $fs_trimmed]
62 62
63 63     foreach file [ad_find_all_files $fs_root] {
64 64         if { [regexp -nocase $static_page_regexp $file match] } {
65 65             # Chop the starting path off of the full pathname and split it up:
66 66             set path [split [string range $file $fs_trimmed_length end] "/"]
67 67             # Throw away the first entry (empty) and the last entry (which is the filename):
68 68             set path [lrange $path 1 [expr [llength $path]-2]]
69 69
70 70             set cumulative_path ""
71 71             set parent_folder_id $root_folder_id
72 72             foreach directory $path {
73 73                 append cumulative_path "$directory/"
74 74                 if (![info exists path_exists($cumulative_path)]) {
75 75                     # check db
76 76                     set folder_id [db_string get_folder_id {
77 77                         select nvl(content_item.get_id(:cumulative_path,:root_folder_id),0)
78 78                         from dual