Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle .phar-Files #908

Open
skipman opened this issue Nov 13, 2024 · 9 comments
Open

Handle .phar-Files #908

skipman opened this issue Nov 13, 2024 · 9 comments

Comments

@skipman
Copy link

skipman commented Nov 13, 2024

The commands for downloading an archive including subsequent unpacking for a project are stored in the sites.conf file.
For a Contao project, I usually use the command Contao 5.3=composer create-project contao/managed-edition %s 5.3.* && curl https://download.contao.org/contao-manager/stable/contao-manager.phar - o %s/public/contao-manager.phar.php.
This works very well.
Now I just want to get the file "contao-manager.phar" from the Contao host and store it in the subfolder public under the name contao-manager.phar.php.
Is that possible, and if so: how?
Thanks for your Inputs!

@husnilkhatimi
Copy link

Try to use this in your sites.conf

Contao=about && echo "create-project" && mkdir "%s\public" && curl -o "%s\public\contao-manager.phar.php" https://download.contao.org/contao-manager/stable/contao-manager.phar

I know this command looks weird and somehow bogus, but trust me, thats how we can trigger laragon.exe to run custom command as programmed by original author.

@skipman
Copy link
Author

skipman commented Nov 13, 2024

Thanks, that works well!
Ist it possible to manipulate the auto.[Projectname].local.conf here too?
For Contao you need the subfolder public as the ROOT directory.

@husnilkhatimi
Copy link

Yes, but need to use external cmd file.

laragon will detect 'public' folder to automatically point the vhost to that folder. the above command will not trigger this because those command run after the detection.

i use this method for Drupal (in sites.conf) of my laragon fork, you can try to install it and find the cmd sample
https://github.com/husnilkhatimi/laragonzo

@skipman
Copy link
Author

skipman commented Nov 16, 2024

Thanks Husnil,
I downloaded your package but couldn't find the cmd sample you were talking about.
If I understood correctly, then you have moved the host configuration into a cmd file, which should be in the laragon/usr/cmd folder. In your case the file is called create-project_drupal.cmd. Is that correct?

@husnilkhatimi
Copy link

Yes that is the file, but I didnt move the host config tu that file.

What happen is, when creating new project, Laragon will invoke that command and WAIT it till finish BEFORE detecting the 'public' folder, so we have the chance to create the folder first.

After the script finish, then only laragon will continue project creation and looking for public folder, and auto-pointing the vhost to public folder.

Hopefully my explaination understandable.

@skipman
Copy link
Author

skipman commented Nov 16, 2024

And the content of the cmd-file is only "mkdir/public"? Can you please paste the code of your cmd-file?

@husnilkhatimi
Copy link

I found out that, laragon will look for index.php in the public folder, try this

  1. Add this line in sites.conf
    Contao=about && call ..\usr\cmd\create-project_contao.cmd "%s"

  2. Create a cmd file with this name inside usr > cmd folder
    create-project_contao.cmd

  3. Open the cmd file with Notepad and paste this code

@echo off 
title LaraGonzo Contao
setlocal enableextensions disabledelayedexpansion

set "dirname=%~1"
if "%dirname%"=="" exit

if exist "%dirname%\" (
  goto :exit 
) 
mkdir "%dirname%\public"
cd "%dirname%\public"
type NUL > index.php
cls
echo Downloading Contao, please wait...
echo.
curl -o "contao-manager.phar.php" https://download.contao.org/contao-manager/stable/contao-manager.phar
:exit
endlocal 

@skipman
Copy link
Author

skipman commented Nov 16, 2024

Thank you again for your support. The solution you mentioned works great!
Can I pass this on to the Contao community by mentioning your name?

@husnilkhatimi
Copy link

Of course, no problem. Glad i can help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants