How to restore app folder in a symfony 3 project? - php

my app folder was deleted without my intention, is there any way to restore it, i have all my routing and Roles configuration in it
i'm using Php storm if this has any relation with my problem

Open Project view, right click on the root directory of your project, Local History -> Show History. If you're lucky, the folder with all its contents will be there. If you're not, have fun restoring everything manually.
Start using a version control system, for crying out loud.

Related

Laravel Envoyer - Where to store user uploads

Docs basically says I need a envoyer-root/storage folder alongside with envoyer-root/current and envoyer-root/releases and then use a system link to link envoyer-root/storage to envoyer-root/releases/{latest one}/public/storage in order to read those files.
What nobody seems to explain is, where are the newly uploaded files saved to? By my application, they'd be uploaded to envoyer-root/releases/{latest one}/public/storage but that wont make it accessible for the new releases.
Do I have to create a post-deploy and manually copy all the files from the previous release to the envoyer-root/storage folder and THEN linking it? Am I missing something?
PD: for references, I'm using Envoyer with a non-laravel project, so I need to understand if I have to modify my source code to work with Envoyer (which seems smelly to me but w/e we already paid for it), or if I don't and I'm not seeing something.
Use the "Linked Folders" (within the Deployment hooks tab) to create a symlink from the currently deployed release to a shared storage folder on the server.
So in your case, you'd want to create a symlink from the currently deployed release to the envoyer-root/storage. In Envoyer, the link from/link at is relative to the "PHP project root", which is your currently deployed release, and the to link is relative to the server root, so you'd have:
Create link at: public/storage (relative to release path)
To: storage (relative to server root)
Symlinks created through the linked folders feature are created on each deployment, so it will always create a symlink for each new release.

Git workflow, am I doing it right?

More and more projects are starting to pile up and I want some workflow and also version control over the different projects. I'm trying to set the "right" workflow with Xampp, Git, GitDesktop and PhpStorm on a Windows 2012r2 machine.
Xampp base: d:\xampp
http://localhost = d:\xampp\htdocs
Dev repositories: d:\xampp\htdocs\repositories\dev\GitDemo
Live repositories: d:\xampp\htdocs\repositories\live\GitDemo
Live folder: d:\xampp\htdocs\GitDemo
Live URL: http://servername/GitDemo (intranet use only)
Right now I have my repositories folder inside the htdocs folder, otherwise I would need another alias/copy action to be able to see what I'm developing. But at the same time the repositories folder is exposed. How to hide this? htaccess?
I've ran git init --bare inside the live folder for this project. With GitDesktop I've created the repository for GitDemo inside d:\xampp\htdocs\repositories\dev.
Using PhpStorm I've created a project based upon local files and pointed it towards d:\xampp\htdocs\repositories\dev\GitDemo. I'm able to see the changes made using git status, add them using git add . and commit them succesfully with git commit -m "my commit..".
I've created a remote server git remote add live master and created a post-receive to checkout the files inside d:\xampp\htdocs\repositories\live\GitDemo to d:\xampp\htdocs\GitDemo.
This all feels like a "ton" of work to set up initially and somewhat redundant (having the same files in 3 locations).
Is this the ideal way to set this up, or do you suggest an alternative approach? Thanks for sharing your thoughts!
I've been thinking about the most logical solution (to my opinion at this moment). Here's how I solved my unclear items as described:
I've optimized it by:
Bringing the repositories directory outside htdocs to d:\repositories\dev\ and d:\repositories\live.
I've set up a symlink to http://localhost/dev/GitDemo that links to
d:\repositories\dev\GitDemo. In this way I don't need to place the
repositories folder inside the htdocs folder and still benefit from
Apache being able to serve the content, which actually resides outside the htdocs folder.
The live version is now placed at http://localhost/GitDemo and with a post-receive hook it gets deployed from d:\repositories\live\GitDemo.git to d:\xampp\htdocs\GitDemo.
If you think I made a mistake or have mistaken something from the way it's supposed to be, please correct me as I'm still not sure this is the correct way but at least it seems like it to me.

Making a copy of Symfony project on server?

I'm trying to copy an existing Symfony project to another directory, so I can test changes before applying them to the live version.
I get a 404 error whenever I try to access the project on the copy via app.php or app_dev.php, and I can't pin down why. The live project is in a folder called representation/mvcrep and the copy is in a folder called representation_dev/mvcrep, and they are both on the same hierarchy in the directory tree.
I've already successfully cleared the cache for both the dev and prod environments in the copy, with no decipherable result. There are no errors in the Symfony logs, and the 404 is one for the site not for Symfony, so I'm assuming it's a problem with the server. Both projects have the exact same permissions as well.
Anyone have any clue to what the problem could be?
Edit: To clarify, the web directory has not been renamed or modified.
As you reported that you use two subfolders in the same virtual host, the web server configuration is probably not the issue here.
Since I suspect permissions issues, I suggest you to debug by creating a base text file in the /representation_dev/mvcrep/web folder, e.g. hello.txt, and see if you can get that via browser.
If not, check the permissions on the newly created folder.
There is not enough info for a precise answer, but this sounds definitely more like a server configuration issue than a Symfony issue,
If you make a copy of your Symfony folder, you also need to create a new web site that points to the new installation.
I.e. previously you browsed the site
http://representation.local/
which has its web root in
.../representation/mvcrep/web
Now you need to create a new site
http://representation_dev.local/
which has its web root in
.../representation_dev/mvcrep/web

Problems with adding an extension in Magento Root directory?

Not sure if i'm at the right place but oh well,
Since a month or two I've started working at a company which uses Magento. Everything was going smoothly, except for the fact that I now try to add an extension to the root directory of Magento through cPanel, in the installation guide I found the following steps:
Installation:
Before installing the extension, please make below notes complete:
Clear your website cache under located at var/cache directory.
If you’re installing extension on live website, please backup your store database and web directory.
Disable Compilation by going to Admin Control Panel -> System -> Tool -> Compilation.
Multi PRODUCT EDITOR Installation:
Extract Multi_Product_Editor-1.0.0.tgz file.
Upload the extracted folders (/app, /js, /skin) respectively into the root of your Magento installation.
From the Admin Control Panel, refresh cache at System => Cache Management. Log out and log in back
now I have found a problem with uploading the extracted folders, because
There are already a folder called App and one called Skin and I'm not sure if I should overwrite those
When I wanted to upload the specific folders, it can't, I can't upload the folder "App" and it only allows me clicking the folder and searching through the folder's folders.
I'm still new to Magento but I learn everyday! please tell me if I'm doing something wrong or if I need to take a step back, I gladly appreciate all your help!
Also, if I wasn't specific enough, or if you need more details, just say so and I'll try adding as much as I can :)
kind regards
Clay
In magento app and skin are mandatory folders so you must not erase them. But if your module you want to add is adding properly, it will just add based on magento structure and create a new module in community or local for the app, and a new design in skin.
Be always careful of where the modules installs things anyway

php, user-uploaded files, version control, and website deployment

I have a website that I regularly update the code to. I keep it in version control. When I want to deploy a new version of the site, I do an export and then symlink the served directory name to the directory of the deployment.
There is a place where users can upload files, and I noticed once that, after I had deployed a new version, the user files were gone! Of course, I hadn't added them to the repository, and since the served site was from an export, they weren't uploaded into a version-controlled directory anyways.
PHP doesn't yet have integrated svn functionality, so I couldn't do much programmatically to user uploaded files. My solution was to create an additional website, files.website.com, which sits in a parallel directory to the served website, and is served out of a directory that is under version control. That way they don't get obliterated when I do an upgrade to the website. From time to time, I manually add uploaded files to the svn project, deleted user-deleted ones, and commit the new version. I'm working on a shell script to run from cron to do this, but it isn't my forte, so it's on the backburner as it's not a pressing need.
Is there a better way to do this?
I usually dont keep user generated data/file in svn. only the code, db schema/test data. What i usually do to deploy is an rsync from an up to date working copy which excludes the upload dir and .svn dirs. IMO content should be handled by more traditional filesystem/db backup mechanisms and not version control.
EDIT:
Just to be clear your symlinking strategy seems like a good practice. youre jsut missing the backup part it think. Id probably just tar | gzip the uploaded stuff in the cron job instead of interacting with SVN. And then probably have a seperate one to use mysqldump to dump the db and gzip that as well.
I would continue with the practice of exporting the site as upgrades are needed but have a symbolic link to a directory outside of the version controlled directory with the user uploaded content. This way when you do an export you only need to recreate the symlink if it gets blown away. You should then of course be backing up that user content as needed.
Rather than manually doing the export and managing symlinks, you could make your deployment directory a subversion checkout (from a production branch). That way, deploying is as simple as checking in your updates to the production branch.
This works as long as you have sufficient control of your subversion server and hosting setup, and your subversion repository is "ready to run." In this situation, your user directory could be an empty placeholder in subversion and would be left alone by the update process that runs on commit (business as usual for svn update). I'd still recommend (as mentioned by #Flash84x and #prodigitalson) a separate process to back up the user content.
There's an Ars Technica article with a description of how to set this up.
Update: If you follow this approach, make sure that your web server does not allow access to the .svn files in the deployment checkout.

Categories