install.php 618 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. //error_reporting(E_ALL);
  3. //检测必须是命令行执行
  4. if(php_sapi_name() != 'cli'){
  5. echo 'intall.php must be executed under cli mode';
  6. exit;
  7. }
  8. //检查命令行参数是否正确
  9. if($_SERVER['argc'] <= 1){
  10. echo 'intall.php must be executed with 1 paramter';
  11. exit;
  12. }
  13. //获取命令行参数 (构件部署配置文件)
  14. $assembly_json = $_SERVER['argv'][1];
  15. if(!file_exists($assembly_json)){
  16. echo 'intall.php must be existing json file';
  17. exit;
  18. }
  19. $indexfile = __DIR__ .'/dp_index.php';
  20. //拷贝index.php
  21. copy($indexfile, dirname(__DIR__) .'/index.php');
  22. echo 'success';
  23. ?>