|
Revision 5030, 0.9 kB
(checked in by tarjei, 2 years ago)
|
The start of a createCrud phing command
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
class configwriter |
|---|
| 7 |
{ |
|---|
| 8 |
public $content = array( ); |
|---|
| 9 |
protected $moduleRoot; |
|---|
| 10 |
public function __construct ( $moduleRoot ) { |
|---|
| 11 |
$this->moduleRoot = $moduleRoot; |
|---|
| 12 |
if ( file_exists( $this->moduleRoot . "/config/config.inc" ) ) |
|---|
| 13 |
{ |
|---|
| 14 |
$raw = file_get_contents( $moduleRoot . "/config/config.inc" ); |
|---|
| 15 |
eval ( "\$this->content = array ( $raw);" ); |
|---|
| 16 |
} |
|---|
| 17 |
$this->content = $this->content; |
|---|
| 18 |
|
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
public function save( ) { |
|---|
| 22 |
var_dump( $this->content ); |
|---|
| 23 |
ob_start( ); |
|---|
| 24 |
foreach ( $this->content as $key => $var ) { |
|---|
| 25 |
echo "'$key' => "; |
|---|
| 26 |
var_export( $var); |
|---|
| 27 |
echo ",\n"; |
|---|
| 28 |
} |
|---|
| 29 |
$ret = ob_get_contents( ); |
|---|
| 30 |
ob_end_clean( ); |
|---|
| 31 |
file_put_contents( $this->moduleRoot . "/config/config.inc", $ret ); |
|---|
| 32 |
} |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|