Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also propagate the comments #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tetrode
Copy link

@tetrode tetrode commented Jan 18, 2017

Adding the possibility to also propagate the comments when writing the ini file. Works as follows:

$ini = 'piwik.ini';
$reader = new \Piwik\Ini\IniReader();
$config = $reader->readFile($ini);
$comments = $reader->readComments($ini);
$writer = new \Piwik\Ini\IniWriter();
$writer->writeToFile('piwik-new.ini', $config, '', $comments);

Things that do not work:

1 pre-section comments disappear:
; section comment
[MySection]
; option comment
myOption = 1

becomes
[MySection]
; option comment
myOption = 1

2 Individual array comments disappear:
[MySection]
; comment a
ar[] = "a"
; comment b
ar[] = "b"
; comment c
ar[] = "c"

becomes
[MySection]
; comment a
ar[] = "a"
ar[] = "b"
ar[] = "c"

Adding the possibility to also propagate the comments when writing the ini file. Works as follows:

$ini = 'piwik.ini';
$reader = new \Piwik\Ini\IniReader();
$config = $reader->readFile($ini);
$comments = $reader->readComments($ini);
$writer = new \Piwik\Ini\IniWriter();
$writer->writeToFile('piwik-new.ini', $config, '', $comments);

Things that do not work:

1 pre-section comments disappear:
  ; section comment
  [MySection]
  ; option comment
  myOption = 1

becomes
  [MySection]
  ; option comment
  myOption = 1

2 Individual array comments disappear:
  [MySection]
  ; comment a
  ar[] = "a"
  ; comment b
  ar[] = "b"
  ; comment c
  ar[] = "c"

becomes
  [MySection]
  ; comment a
  ar[] = "a"
  ar[] = "b"
  ar[] = "c"
@coveralls
Copy link

Coverage Status

Coverage decreased (-11.7%) to 70.673% when pulling a37cd9f on tetrode:patch-1 into bd2711b on piwik:master.

@mattab
Copy link
Member

mattab commented Feb 18, 2017

Thanks for the PR @tetrode

Could you please add some unit/integration tests, to make sure your feature will not break in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants