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
        
    }

Variables

::xolirc::Package set __default_metaclass ::xotcl::Class
::xolirc::Package set __default_superclass ::xotcl::Object
::xolirc::Package set abstract_p f
::xolirc::Package set auto_save false
::xolirc::Package array set db_constraints {}
::xolirc::Package array set db_slot {package_id ::xolirc::Package::slot::package_id}
::xolirc::Package set default_package_parameter_page_info {}
::xolirc::Package set default_package_parameters {}
::xolirc::Package set id_column package_id
::xolirc::Package set name_method {}
::xolirc::Package set object_type ::xolirc::Package
::xolirc::Package set object_type_key 00000000000001010000001000000000
::xolirc::Package set package_key xolirc
::xolirc::Package set pretty_name {IRC Logs displayer based on Xowiki}
::xolirc::Package set pretty_plural {IRC Logs displayer based on Xowiki}
::xolirc::Package set security_inherit_p t
::xolirc::Package set site_wide_package_parameter_page_info {}
::xolirc::Package set site_wide_package_parameters {}
::xolirc::Package set site_wide_pages {}
::xolirc::Package set sql_package_name ::xolirc::Package
::xolirc::Package set supertype acs_object
::xolirc::Package set table_name xolirc_package
::xolirc::Package set with_table true