File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -413,5 +413,40 @@ When `DOCUMENT-ROOT' is NIL, the document root is obtained from `ROUTER-OR-DIR'.
413
413
(if (called-interactively-p 'interactive ) #'display-buffer #'get-buffer )
414
414
(format " *%s * " buf-name))))
415
415
416
+ (defun php-ini ()
417
+ " Get `php --ini' output buffer."
418
+ (interactive )
419
+ (let ((buffer (get-buffer-create " *php --ini*" )))
420
+ (with-current-buffer buffer
421
+ (view-mode -1 )
422
+ (read-only-mode -1 )
423
+ (erase-buffer )
424
+ (shell-command (concat php-executable " --ini" ) buffer)
425
+ (view-mode +1 ))
426
+ (if (called-interactively-p 'interactive )
427
+ (pop-to-buffer buffer)
428
+ buffer)))
429
+
430
+ (defun php-find-system-php-ini-file (&optional file )
431
+ " Find php.ini FILE by `php --ini'."
432
+ (interactive
433
+ (list
434
+ (let* ((default-directory (expand-file-name " ~" ))
435
+ (buffer (php-ini))
436
+ (path (with-current-buffer buffer
437
+ (goto-char (point-min ))
438
+ (save-match-data
439
+ (when (re-search-forward " : \\ (.+?\\ )$" nil nil )
440
+ (match-string 1 ))))))
441
+ (when (or (null path) (not (file-directory-p path)))
442
+ (when (called-interactively-p 'interactive )
443
+ (pop-to-buffer buffer))
444
+ (user-error " Failed get path to PHP ini files directory" ))
445
+ (read-file-name " Find php.ini file: "
446
+ (concat (expand-file-name path) " /" )
447
+ nil nil nil
448
+ #'file-exists-p ))))
449
+ (find-file file))
450
+
416
451
(provide 'php )
417
452
; ;; php.el ends here
You can’t perform that action at this time.
0 commit comments