-
Notifications
You must be signed in to change notification settings - Fork 2
/
configtest.php
37 lines (27 loc) · 912 Bytes
/
configtest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
define('DRUPAL_ROOT', getcwd());
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
config_write_signed_file_storage_key();
//echo config_sign_data('onetwothree');
$sfs = new SignedFileStorage('one.two');
// Write and read
$sfs->write('nothing');
echo $sfs->read() . PHP_EOL;
$existing_content = file_get_contents($sfs->getFilePath());
echo $sfs->getFilePath() . PHP_EOL;
// Modify and resign
file_put_contents($sfs->getFilePath(), $existing_content . 'extra');
$sfs->resign();
echo $sfs->read() . PHP_EOL;
// Fail
//file_put_contents($sfs->getFilePath(), $existing_content . 'extra');
//echo $sfs->read() . PHP_EOL;
print_r(get_signed_file_storage_names_with_prefix());
print '<hr>';
$config = config('foo.bar');
$config->foo = 'bar';
$config->save();
echo config('foo.bar')->foo;
echo '<br>That should be bar';