@@ -29,6 +29,7 @@ public function install(array $options = null) : bool
2929
3030 $ this ->appcontext ->runUser ('v-copy-fs-file ' ,[$ this ->getDocRoot ("config-dist.php " ), $ this ->getDocRoot ("config.php " )]);
3131 $ this ->appcontext ->runUser ('v-copy-fs-file ' ,[$ this ->getDocRoot ("admin/config-dist.php " ), $ this ->getDocRoot ("admin/config.php " )]);
32+ $ this ->appcontext ->runUser ('v-copy-fs-file ' ,[$ this ->getDocRoot (".htaccess.txt " ), $ this ->getDocRoot (".htaccess " )]);
3233 $ this ->appcontext ->runUser ('v-run-cli-cmd ' , [
3334 "/usr/bin/php " ,
3435 $ this ->getDocRoot ("/install/cli_install.php " ),
@@ -41,6 +42,13 @@ public function install(array $options = null) : bool
4142 "--email " . $ options ['opencart_account_email ' ],
4243 "--http_server " . "http:// " . $ this ->domain . "/ " ], $ status );
4344
45+ // After install, 'storage' folder must be moved to a location where the web server is not allowed to serve file
46+ // - Opencart Nginx template and Apache ".htaccess" forbids acces to /storage folder
47+ $ this ->appcontext ->runUser ('v-move-fs-directory ' , [$ this ->getDocRoot ("system/storage " ), $ this ->getDocRoot ()], $ result );
48+ $ this ->appcontext ->runUser ('v-run-cli-cmd ' , [ "sed " , "-i " , "s/'storage\//'..\/storage\// " , $ this ->getDocRoot ("config.php " ) ], $ status );
49+ $ this ->appcontext ->runUser ('v-run-cli-cmd ' , [ "sed " , "-i " , "s/'storage\//'..\/storage\// " , $ this ->getDocRoot ("admin/config.php " ) ], $ status );
50+ $ this ->appcontext ->runUser ('v-run-cli-cmd ' , [ "sed " , "-i " , "s/\^system\/storage\//^\/storage\// " , $ this ->getDocRoot (".htaccess " ) ], $ status );
51+
4452 $ this ->appcontext ->runUser ('v-change-fs-file-permission ' ,[$ this ->getDocRoot ("config.php " ), '640 ' ]);
4553 $ this ->appcontext ->runUser ('v-change-fs-file-permission ' ,[$ this ->getDocRoot ("admin/config.php " ), '640 ' ]);
4654
0 commit comments