- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xolirc::Package
::xolirc::Package create ...
Defined in
Class Relations
::xo::PackageMgr create ::xolirc::Package \ -superclass ::xowiki::PackageMethods (to be applied on the object)
create-page-from-log (scripted, public)
xolirc::Package create-page-from-log [ -overwrite overwrite ] \ [ -date date ]
- Switches:
- -overwrite (optional, defaults to
"1"
)- Indicates if the content of the page will be overwritted in case the page exists already.
- -date (optional)
- Indicates the date of the log html files to read from.
- Testcases:
- No testcase defined.
set package_id [apm_package_ids_from_key -mounted -package_key xolirc] ::xolirc::Package initialize -package_id $package_id -init_url 0 -actual_query "" if {$date ne ""} { regsub -all -- "-" $date {} date } else { set date [parameter::get -package_id $package_id -parameter "date2process" -default [clock format [clock seconds] -format "%Y%m%d"]] #ns_log notice "about to process $date" parameter::set_value -package_id $package_id -parameter "date2process" -value [clock format [clock seconds] -format "%Y%m%d"] } #ns_log notice "vguerra the date is $date" set text [$package_id get-html-from-log -date $date] if { $text eq "" } { ns_log Warning "xolirc: Nothing has been logged yet for the date [$package_id dash-date $date]" return "" } set page [$package_id resolve_page_name "en:$date"] if {$page eq ""} { set page [::xowiki::Page new -title "Conversation log in #openacs on [$package_id dash-date $date]" -name "en:$date" -package_id $package_id -parent_id [$package_id folder_id] -destroy_on_cleanup -text [list $text]] $page initialize_loaded_object $page save_new } elseif { $overwrite } { $page set text [list $text] $page save } set creation_date "[$package_id dash-date $date]" db_dml update_date "update acs_objects set creation_date = :creation_date where object_id = [$page set revision_id]"process-all-logs (scripted, public)
xolirc::Package process-all-logs [ -overwrite overwrite ]Goes through all the log files and creates the respective xowiki Page.
- Switches:
- -overwrite (optional, defaults to
"1"
)- In case that the page exists for the processing date, this parameter if overwrite it (1) or not (0).
- Testcases:
- No testcase defined.
#my instvar logs_path set logs_path "/usr/local/eggdrop/html/" foreach log [glob -nocomplain -directory $logs_path "openacs*_pg1.html"] { regexp {.*openacs(\d{8})_pg1\.html} $log match date ns_log notice "working on $date" ::xolirc::Package create-page-from-log -overwrite $overwrite -date $date }Methods (to be applied on instances)
dash-date (scripted)
return "[string range $date 0 3]-[string range $date 4 5]-[string range $date 6 7]"get-html-from-log (scripted)
my instvar logs_path if {$date eq ""} { set date [clock format [clock seconds] -format "%Y%m%d"] } set content "" foreach log [lsort -dictionary [glob -nocomplain -directory $logs_path "openacs${date}*"]] { # We get the content of the div with id=mainblock that contains all the html # that we need to fill with the xowiki pages set file [open $log] set html [read $file] ; close $file regexp "<body class=\"l2hLogPage\">(.*)<\/body>" $html body set doc [dom parse -html $body] set body [$doc documentElement] set navtop [$body selectNodes "div/div/div\[@id='navtop'\]"] $navtop delete append content "[[$body selectNodes div/div\[@id='mainblock'\]] asHTML]" $doc delete } return $contentinitialize (scripted)
my set logs_path "/usr/local/eggdrop/html/"insert (scripted)
set __table_name [[self class] table_name] set __id [[self class] id_column] set :$__id ${:object_id} :log "ID insert in $__table_name, id = $__id = [set :$__id]" next foreach {__slot_name __slot} [[self class] array get db_slot] { if {[info exists :$__slot_name]} { set $__slot_name [set :$__slot_name] lappend __vars $__slot_name lappend __atts [$__slot column_name] } } ::xo::dc dml insert_$__table_name "insert into $__table_name ([join $__atts ,]) values (:[join $__vars ,:])"package_id (setter)
query-actual-log (scripted)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables