More cleanup
This commit is contained in:
parent
c0016c759a
commit
52ce3714cf
@ -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'];
|
$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";
|
$url .= "/{$result['results'][0]['id']}/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->putAttachment($url, $id, $attachment);
|
$this->putAttachment($url, $attachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
|
|||||||
} else if ($file instanceof ComputedRaw) {
|
} else if ($file instanceof ComputedRaw) {
|
||||||
$filename = $file->getUri();
|
$filename = $file->getUri();
|
||||||
$this->attachments[$filename] = ['filename' => $filename, 'content' => $file->getContent()];
|
$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);
|
return $this->createImageTag($filename, $attributes);
|
||||||
|
@ -36,8 +36,6 @@ class Publisher
|
|||||||
|
|
||||||
$this->client = new Api($confluence['base_url'], $confluence['user'], $confluence['pass']);
|
$this->client = new Api($confluence['base_url'], $confluence['user'], $confluence['pass']);
|
||||||
$this->client->setSpace($confluence['space_id']);
|
$this->client->setSpace($confluence['space_id']);
|
||||||
|
|
||||||
$this->deletable = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run($title, $closure)
|
public function run($title, $closure)
|
||||||
@ -82,7 +80,6 @@ class Publisher
|
|||||||
{
|
{
|
||||||
if (array_key_exists('ancestor_id', $this->confluence)) {
|
if (array_key_exists('ancestor_id', $this->confluence)) {
|
||||||
$pages = $this->client->getList($this->confluence['ancestor_id']);
|
$pages = $this->client->getList($this->confluence['ancestor_id']);
|
||||||
$published = null;
|
|
||||||
foreach ($pages as $page) {
|
foreach ($pages as $page) {
|
||||||
if ($page['title'] == $tree['title']) {
|
if ($page['title'] == $tree['title']) {
|
||||||
return $page;
|
return $page;
|
||||||
|
@ -27,6 +27,9 @@ class PublisherDelete
|
|||||||
$this->output = $output;
|
$this->output = $output;
|
||||||
$this->delete = $delete;
|
$this->delete = $delete;
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
|
|
||||||
|
|
||||||
|
$this->deletable = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function listDeletable($published, $prefix = '')
|
protected function listDeletable($published, $prefix = '')
|
||||||
|
@ -14,7 +14,7 @@ class Config extends BaseConfig
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditOn()
|
public function getEditOn()
|
||||||
{
|
{
|
||||||
if (array_key_exists('edit_on', $this)) {
|
if (array_key_exists('edit_on', $this)) {
|
||||||
if (is_string($this['edit_on'])) {
|
if (is_string($this['edit_on'])) {
|
||||||
|
@ -18,6 +18,11 @@ class Server
|
|||||||
private $params;
|
private $params;
|
||||||
private $base_url;
|
private $base_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Request
|
||||||
|
*/
|
||||||
|
private $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serve the documentation
|
* Serve the documentation
|
||||||
*
|
*
|
||||||
@ -65,7 +70,7 @@ class Server
|
|||||||
* @param string $postfix
|
* @param string $postfix
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getTemporaryFile($postfix) {
|
private function getTemporaryFile($postfix) {
|
||||||
$sysFileName = tempnam(sys_get_temp_dir(), 'daux');
|
$sysFileName = tempnam(sys_get_temp_dir(), 'daux');
|
||||||
if ($sysFileName === false) {
|
if ($sysFileName === false) {
|
||||||
throw new \RuntimeException("Could not create temporary file");
|
throw new \RuntimeException("Could not create temporary file");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user