%3 ::xolirc::Package ::xolirc::Package → create-page-from-log → process-all-logs dash-date get-html-from-log initialize insert query-actual-log ::xowiki::Package ::xowiki::Package → get_package_id_from_page_id → get_url_from_id → google_sitemapindex → instantiate_page_from_id → is_xowiki_p → preferredCSSToolkit → reparent_site_wide_pages call check_permissions clipboard-copy condition=has_class condition=has_name create_new_snippet default_language default_locale delete_revision error_msg external_name flush_name_cache flush_page_fragment_cache flush_references folder_path get_adp_template get_ids_for_bulk_actions get_lang_and_name get_package_id_from_page_name get_page_from_item_or_revision_id get_page_from_item_ref get_page_from_name get_page_from_super get_parameter get_parameter_from_parameter_page get_parent_and_name import init insert invoke item_info_from_id item_info_from_url item_ref join_name lookup make_form_link make_link normalize_name normalize_path package_path prefixed_lookup pretty_link query_parameter_return_url reparent require_folder_object require_root_folder resolve_package_path resolve_page resolve_page_name resolve_page_name_and_init_context show_page_order simple_item_ref split_name validate_tag www-change-page-order www-delete www-edit-category-tree www-edit-new www-google-sitemap www-google-sitemapindex www-import-prototype-page www-manage-categories www-refresh-login www-reindex www-rss www-update-references ::xolirc::Package->::xowiki::Package ::s5::Package ::s5::Package init insert ::s5::Package->::xowiki::Package ::xowf::Package ::xowf::Package → create_new_workflow_page call destroy initialize insert ::xowf::Package->::xowiki::Package ::xowiki::ParameterCache ::xowiki::ParameterCache get_parameter ::xotcl::Object ::xotcl::Object ::xowiki::ParameterCache->::xotcl::Object ::xowiki::Package->::xowiki::ParameterCache instmixin ::xo::Package ::xo::Package ::xowiki::Package->::xo::Package

Class ::xolirc::Package

::xolirc::Package[i] create ...

Defined in

Class Relations

  • class: ::xo::PackageMgr[i]
  • superclass: ::xowiki::Package[i]
::xo::PackageMgr create ::xolirc::Package \
     -superclass ::xowiki::Package

Methods (to be applied on the object)

  • create-page-from-log (scripted, public)

     xolirc::Package[i] 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[i] 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 $content
  • initialize (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)