File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
web/src/app/WebApp/Installers/Grav Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,36 @@ class GravSetup extends BaseSetup {
1919
2020 protected $ config = [
2121 'form ' => [
22- "ignore this " =>"text " ,
22+ 'admin ' => ['type ' =>'boolean ' , 'value ' =>false , 'label ' => "Create admin account " ],
23+ 'username ' => ['text ' =>'admin ' ],
24+ 'password ' => 'password ' ,
25+ 'email ' => 'text '
2326 ],
2427 'database ' => false ,
2528 'resources ' => [
2629 'composer ' => [ 'src ' => 'getgrav/grav ' , 'dst ' => '/ ' ]
27- ],
30+ ],
2831 ];
2932
3033 public function install (array $ options = null )
3134 {
3235 parent ::install ($ options );
36+ if ( $ options ['admin ' ] == true ){
37+ chdir ($ this ->getDocRoot ());
38+ $ this -> appcontext -> runUser ('v-run-cli-cmd ' , ['php ' ,
39+ $ this ->getDocRoot ('/bin/gpm ' ),
40+ 'install admin '
41+ ], $ status );
42+ $ this -> appcontext -> runUser ('v-run-cli-cmd ' , ['php ' ,
43+ $ this ->getDocRoot ('/bin/plugin ' ),
44+ 'login new-user ' ,
45+ '-u ' .$ options ['username ' ],
46+ '-p ' .$ options ['password ' ],
47+ '-e ' .$ options ['email ' ],
48+ '-P a ' ,
49+ '-N ' .$ options ['username ' ]
50+ ], $ status );
51+ }
3352 return (1 );
3453 }
3554}
You can’t perform that action at this time.
0 commit comments