Ejemplo n.º 1
0
 /**
  * Fetches our export data as a multi-dimensional array
  *
  * @return array The export data
  */
 protected function get_export_data($manual = true, $targetstarttime = 0, $lastruntime = 0)
 {
     global $CFG;
     $file = get_plugin_directory('dhexport', 'version1') . '/version1.class.php';
     require_once $file;
     // Plugin for file IO.
     $fileplugin = new rlip_fileplugin_bogus();
     $fileplugin->open(RLIP_FILE_WRITE);
     // Our specific export.
     $exportplugin = new rlip_exportplugin_version1($fileplugin, $manual);
     $exportplugin->init($targetstarttime, $lastruntime);
     $exportplugin->export_records(0);
     $exportplugin->close();
     $fileplugin->close();
     return $fileplugin->get_data();
 }
 /**
  * Run the export for whatever data is currently in the database
  *
  * @param int $targetstarttime The timestamp representing the theoretical
  *                             time when this task was meant to be run
  * @param int $writedelay      The number of seconds delay each write call
  *                             (passed to rlip_fileplugin_memoryexport)
  * @param int $lastruntime     The last time the export was run
  *                             (required for incremental scheduled export)
  * @param int $maxruntime      The max time in seconds to complete export
  *                             default: 0 => unlimited
  * @param object $state        Previous ran state data to continue from
  * @uses  $CFG
  * @return object              state object on error (time limit exceeded)
  *                             null on success!
  */
 public function run_export($targetstarttime = 0, $writedelay = 0, $lastruntime = 0, $maxruntime = 0, $state = null)
 {
     global $CFG;
     $file = get_plugin_directory('dhexport', 'version1') . '/version1.class.php';
     require_once $file;
     // Set the log file location to the dataroot.
     $filepath = $CFG->dataroot;
     // Plugin for file IO.
     $fileplugin = new rlip_fileplugin_memoryexport($writedelay);
     $fileplugin->open(RLIP_FILE_WRITE);
     // Cleanup log files first.
     self::cleanup_log_files();
     // Our specific export.
     $exportplugin = new rlip_exportplugin_version1($fileplugin);
     return $exportplugin->run($targetstarttime, $lastruntime, $maxruntime, $state);
 }