Added debug to confluence publishing

This commit is contained in:
Stéphane Goetz 2015-06-29 16:16:55 +02:00 committed by Stéphane Goetz
parent 5791fccea8
commit b5dd82fe2a
1 changed files with 13 additions and 2 deletions

View File

@ -158,7 +158,7 @@ class Publisher
return true;
}
$trimmed_local = trim($local);
$trimmed_local = trim($local->getContent());
$trimmed_distant = trim($published['content']);
if ($trimmed_local == $trimmed_distant) {
@ -174,6 +174,17 @@ class Publisher
return false;
}
//DEBUG
if (getenv("DEBUG") && strtolower(getenv("DEBUG")) != "false") {
$prefix = 'static/export/';
if (!is_dir($prefix)) {
mkdir($prefix, 0777, true);
}
$url = $local->getFile()->getUrl();
file_put_contents($prefix . strtr($url, ['/' => '_', '.html' => '_local.html']), $trimmed_local);
file_put_contents($prefix . strtr($url, ['/' => '_', '.html' => '_distant.html']), $trimmed_distant);
}
return true;
}
@ -187,7 +198,7 @@ class Publisher
echo "- " . $this->niceTitle($entry['file']->getUrl());
try {
if ($this->shouldUpdate($entry['page']->getContent(), $published)) {
if ($this->shouldUpdate($entry['page'], $published)) {
$this->client->updatePage(
$parent_id,
$published['id'],