示例#1
0
 protected function process_data(&$signal)
 {
     $result = parent::process_data($signal);
     if ($result === false) {
         return false;
     }
     $title = $signal->data_title($this->default_data_key);
     if (is_null($title)) {
         $this->log("Could not determine the title from a signal!", LL_ERROR);
         return false;
     }
     if (!empty($this->tasks)) {
         $to_title = $title;
         if (array_key_exists('with', $this->tasks)) {
             $to_title = $this->do_rule($to_title, $this->tasks);
         } else {
             foreach ($this->tasks as $task) {
                 $to_title = $this->do_rule($to_title, $task);
             }
         }
         $result = $title !== $to_title;
         if ($result) {
             $signal->set_param('writer', 'to_title', $to_title);
             $this->add_changes("Moving [[{$title}]] as [[{$to_title}]]");
         }
     } else {
         $this->log("Title [[" . $title . "]] is not to be changed", LL_DEBUG);
     }
     $this->set_jobdata($result);
     return $result;
 }
示例#2
0
 protected function process_data(&$signal)
 {
     $result = parent::process_data($signal);
     if ($result === false) {
         return false;
     }
     if ($this->autofetch) {
         $this->autofetcher_page->create_missing_pages = $this->autofetcher_create_missing_pages;
         if (!$this->autofetcher_page->check_and_fetch($signal)) {
             return false;
         }
     }
     $data_block = $signal->data_block($this->default_data_key);
     if ($data_block['type'] == "array/page") {
         $data_block['*'] = new Page($this->core, $data_block['*']);
         $data_block['type'] = "object/page";
     }
     if ($data_block['type'] !== "object/page") {
         $this->log("Could not recognize data as a page!", LL_ERROR);
         return false;
     }
     $result = $this->make_edits($data_block);
     $signal->set_data_block($this->default_data_key, $data_block);
     $this->set_jobdata($result);
     return $result;
 }