Example #1
0
 protected function updatePage($parent_id, $entry, $published)
 {
     if ($this->previous_title != 'Updating') {
         $this->previous_title = 'Updating';
         echo "Updating Pages...\n";
     }
     $this->run('- ' . $this->niceTitle($entry['file']->getUrl()), function () use($entry, $published, $parent_id) {
         if ($this->shouldUpdate($entry['page'], $published)) {
             $this->client->updatePage($parent_id, $published['id'], $published['version'] + 1, $entry['title'], $entry['page']->getContent());
         }
     });
     if (count($entry['page']->attachments)) {
         foreach ($entry['page']->attachments as $attachment) {
             $this->run("  With attachment: {$attachment['filename']}", function () use($published, $attachment) {
                 $this->client->uploadAttachment($published['id'], $attachment);
             });
         }
     }
 }