Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Composer/Processor/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private function addAttachments(): void {
'global-title-revisions'
);

$this->numOfXmlCountDigits = strlen( (string)count( $titleRevisions ) );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be done in for Comments as well?


/** Add grouped pages */
foreach ( $titleRevisions as $pageTitle => $pageRevisions ) {
if ( $this->skipTitle( $pageTitle ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/Composer/Processor/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private function addContentPages(): void {
/** Prepare required maps */
$bodyContentIdMainpageId = $this->buildMainpageContentMap( $spaceIdHomepagesMap );

$this->numOfXmlCountDigits = strlen( (string)count( $titleRevisions ) );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there are more revisions than defined in config composer-page-per-xml-limit, it creates another file.

$this->numOfXmlCountDigits is derived from $titleRevisions.

but $this->numOfRevisions++; happens as many times as there are $pageRevisions in each $titleRevisions with each $this->addRevision.

I guess this leads to outputfiles with the same numbering or?

/** Add grouped pages */
foreach ( $titleRevisions as $pageTitle => $pageRevisions ) {
if ( $this->skipTitle( $pageTitle ) ) {
Expand Down
5 changes: 4 additions & 1 deletion src/Composer/Processor/ProcessorBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ abstract class ProcessorBase implements IConfluenceComposerProcessor {
/** @var int */
protected $limit = 0;

/** @var int */
protected $numOfXmlCountDigits = 3;

/** @var int */
protected $numOfRevisions = 0;

Expand Down Expand Up @@ -125,7 +128,7 @@ protected function writeOutputFile(): void {
if ( $this->mulitXmlOutputEnabled ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

$this->outputXmlFile++;
$num = (string)$this->outputXmlFile;
$name .= '-' . str_pad( $num, 8, STR_PAD_LEFT );
$name .= '-' . str_pad( $num, $this->numOfXmlCountDigits, 0, STR_PAD_LEFT );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third argument of str_pad is a string, not a int.
Should be:
str_pad( $num, $this->numOfXmlCountDigits, '0', STR_PAD_LEFT );

}

$name .= '.xml';
Expand Down
Loading