More cleanup

This commit is contained in:
Stéphane Goetz
2017-11-07 22:54:31 +01:00
parent c0016c759a
commit 52ce3714cf
6 changed files with 14 additions and 7 deletions

View File

@ -269,7 +269,7 @@ class Api
}
}
private function putAttachment($url, $id, $attachment)
private function putAttachment($url, $attachment)
{
$contents = array_key_exists('file', $attachment) ? fopen($attachment['file']->getPath(), 'r') : $attachment['content'];
@ -322,6 +322,6 @@ class Api
$url .= "/{$result['results'][0]['id']}/data";
}
$this->putAttachment($url, $id, $attachment);
$this->putAttachment($url, $attachment);
}
}

View File

@ -28,6 +28,8 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
} else if ($file instanceof ComputedRaw) {
$filename = $file->getUri();
$this->attachments[$filename] = ['filename' => $filename, 'content' => $file->getContent()];
} else {
throw new \RuntimeException("Cannot embed image as we don't understand its type.");
}
return $this->createImageTag($filename, $attributes);

View File

@ -36,8 +36,6 @@ class Publisher
$this->client = new Api($confluence['base_url'], $confluence['user'], $confluence['pass']);
$this->client->setSpace($confluence['space_id']);
$this->deletable = [];
}
public function run($title, $closure)
@ -82,7 +80,6 @@ class Publisher
{
if (array_key_exists('ancestor_id', $this->confluence)) {
$pages = $this->client->getList($this->confluence['ancestor_id']);
$published = null;
foreach ($pages as $page) {
if ($page['title'] == $tree['title']) {
return $page;

View File

@ -27,6 +27,9 @@ class PublisherDelete
$this->output = $output;
$this->delete = $delete;
$this->client = $client;
$this->deletable = [];
}
protected function listDeletable($published, $prefix = '')