protected function process_data(&$signal) { parent::process_data($signal); $id = $signal->data_blockid($this->default_data_key); if (is_null($this->id)) { return false; } $params = array('prop' => $this->prop, 'ids' => $id); require_once dirname(__FILE__) . '/../../../../core/queries/list/blocks.php'; $query = new Query_List_Blocks($this->core); $block = $query->go($params); $result = $this->set_fetched_data($signal, $block); $this->set_jobdata($result, array('id' => $id, 'prop' => $this->prop)); return $result; }
protected function process_data(&$signal) { if (!parent::process_data($signal)) { return false; } $file = $signal->data_element($this->default_data_key); if (is_object($file) && $file instanceof Dataobject) { $element = $file->data(); } elseif (is_string($file)) { $element = array('url' => $file, 'title' => basename($file)); } else { $this->log("Could not determine the URL to fetch the file body from!", LL_ERROR); return false; } if (isset($this->body_file)) { if ($this->body_file === "") { $this->core->browser->write_into_file = sha1($element['title']); } else { $this->core->browser->write_into_file = $this->body_file; } } $browser_max_retries = $this->core->browser->max_retries; $this->core->browser->max_retries = 50; try { $result = $this->core->browser->xfer($element['url']); } catch (Exception $e) { $result = false; } if ($result) { if (isset($this->body_file)) { $element['body_link'] = $this->core->browser->write_into_file; $element['body_link_is_tempfile'] = true; $filesize = filesize($element['body_link']); } else { $element['body'] = $this->core->browser->content; $filesize = strlen($element['body']); } $this->log("Fetched also file body ({$filesize} bytes)", LL_DEBUG); } else { $this->log("Tried, but could not fetch the file body!", LL_WARNING); } $this->core->browser->max_retries = $browser_max_retries; unset($this->core->browser->write_into_file); $file = new File($this->core, $element); $result = $this->set_fetched_data($signal, $file); $this->set_jobdata($result); return $result; }
protected function process_data(&$signal) { parent::process_data($signal); $params = array(); if (isset($this->properties)) { $params['properties'] = $this->properties; } if (isset($this->revid)) { $params['revid'] = $this->revid; } if (isset($this->section)) { $params['section'] = $this->section; } $page = $this->fetch_page($signal, $params); if ($page === false && $this->create_missing_pages && !is_null($title = $signal->data_title($this->default_data_key))) { $page = new Page($this->core, array('title' => $title)); $this->log("Creating page [[{$title}]] object by title only..."); } $result = $this->set_fetched_data($signal, $page); $this->set_jobdata($result); return $result; }
protected function process_data(&$signal) { if (!parent::process_data($signal)) { return false; } if (!isset($this->batch_size)) { $this->batch_size = $this->core->info->pagesetmodule_available_limit($this->is_content_in_properties()); } $title = $signal->data_title($this->default_data_key); if (in_array($title, $this->titles)) { $this->log("Skipped [[{$title}]] from batch fetching - already queued", LL_DEBUG); } else { $this->titles[] = $title; $this->log("Queued [[{$title}]] for batch fetching (" . count($this->titles) . " so far)", LL_DEBUG); } if (count($this->titles) >= $this->batch_size) { $result = $this->fetch_and_propagate_batch(); $this->titles = array(); } else { $result = true; } $this->set_jobdata($result); return $result; }
protected function process_data(&$signal) { if (!parent::process_data($signal)) { return false; } $title = $signal->data_title($this->default_data_key); if (is_null($title)) { return false; } $namespace = $this->core->info->title_namespace($title); if (empty($namespace)) { $title = $this->core->info->namespace_name('File') . ':' . $title; } $params = array('title' => $title, 'properties' => array('imageinfo' => array())); $paramnames = $this->core->info->param_querymodule_parameters_names('imageinfo'); foreach ($paramnames as $paramname) { if (isset($this->{$paramname}) && !is_null($this->{$paramname})) { $params['properties']['imageinfo'][$paramname] = $this->{$paramname}; } } if (empty($params['properties']['imageinfo']['prop'])) { $params['properties']['imageinfo']['prop'] = $this->core->info->param_querymodule_parameter_type('prop', 'imageinfo'); } require_once dirname(__FILE__) . '/../../../../core/tasks/fetch_filename.php'; $task = new Task_FetchFilename($this->core); $file = $task->go($params); if ($file !== false && $this->fetch_body) { if (isset($this->body_file)) { if ($this->body_file == "") { $this->core->browser->write_into_file = sha1($title); } else { $this->core->browser->write_into_file = $this->body_file; } } $browser_max_retries = $this->core->browser->max_retries; $this->core->browser->max_retries = 50; try { $result = $this->core->browser->xfer($file->url); } catch (Exception $e) { $result = false; } if ($result) { if (!isset($this->body_file)) { $file->body = $this->core->browser->content; $filesize = strlen($file->body); } else { $file->body_link = $this->core->browser->write_into_file; $file->body_link_is_tempfile = true; $filesize = filesize($file->body_link); } $this->log("Fetched also the file body - {$filesize} bytes", LL_DEBUG); } else { $this->log("Tried, but could not fetch the file body!", LL_WARNING); } $this->core->browser->max_retries = $browser_max_retries; unset($this->core->browser->write_into_file); } $result = $this->set_fetched_data($signal, $file); $this->set_jobdata($result, array_merge(array('title' => $title, 'fetch_body' => $this->fetch_body), $params['properties']['imageinfo'])); return $result; }