Shared Files in TFS 2010 - php

I'm fairly new to TFS 2010, so please excuse any naivety. My organization uses it to manage all the code for their Windows products. I've been tasked with migrating our web applications to the same system.
There are multiple projects, all in PHP, and (through what seems to be to me crazy InvokeProcess voodoo) I have the builds successfully pushing to our UNIX staging and live servers.
The problem is shared headers and footers on the web pages. From my research I've found that TFS does not support sharing or linking of source code. However I'm curious if anyone else has been in this or a similar situation and how they managed to solve it.
Basically I'm looking for a way to have consistent headers and footers among all the PHP applications while only needing to change one file when I need to update them.
Any advice will be greatly appreciated.

I am not familiar with PHP, so I don't know if it is possible to use re-use a file. In visual studio for example you can pull in a file from any location. In that case the sharing is done because each application is using the same file.
If that is not possible, you can use branching to create linked copies of the file. If there is a new version of the file, you need to merge those changes to all the branches.

Related

How can I tell if a project is done with a PHP framework?

I am working on a project (already started), but I do not know if it is done with framework since there are files in many different folders, but I do not see any syntax referring to some framework that I know of.
I hope someone can help me...
Well it would depend on the Folder Hierarchies and the code.
If the views folder has the term "blade" on it, it's definitely laravel.
If the the code of the library has the term "CI Controller" somewhere in the libraries its definitely CodeIgniter.
If the code has a lot of "wp-" string in its code, its definitely Wordpress.
TIP: Put the whole folder in Sublime, search the folder (right click the folder and choose "Find in folder...") and search for terms that are generally reserved words for mostly used frameworks.
There are different methods to identify the PHP framework used by a web application. But one of the easiest way I would like to share it with you to use this extension in your browser called Wappalyzer.
Wappalyzer is a cross-platform utility that uncovers the technologies used on websites. It detects content management systems, e-commerce platforms, web frameworks, server software, analytics tools and many more.
There are a few other tools out there that analyze what a website is using.
BuiltWith - Stand alone site, also available as a plugin
W3Techs - Stand alone site, also available as a plugin
Auto-generated comments may also help. In my case, I can tell from the comments in index.php that it's written in CodeIgniter.
If you have a copy of the project hosted somewhere you can use https://builtwith.com

Tools for analyse code usage on production enviroment

I develop online shopping system. Currently it runs few hundreds different online stores (on different machines).The code base is developed as one release but each shop instance has own plugins and configuration to adjust system to their custom business needs. The system is being developed for 7 years and it became really big. Due to its age there is a lot of legacy code. I want to figure out which modules/classes are supposed to be deleted. The unnecessary code muddy the water.
I came up with an idea to build "super easy dynamic analysing code usage tool" based on file access time. I assumed that including file in PHP touches it some how. It would be extreamly easy to find out which part of code (whole classes) are not used for years. This woudn't need any libraries integration as xdebug and wouldn't cause any performance hit. Also we have access to historical data (filesystem). But I came accross some difficulties (Why does PHP include() not change file access time?)
Maybe I am inventing the wheel? Maybe there are existing solutions on the market to achieve my goals? I would apprecieate any suggestion. Thanks you in advance.

ExpressionEngine source control via git

Im stuck with supporting some ExpressionEngine sites and I'm trying to check this CMS into source control.
I am failing since I cannot see a way to decouple the database from the templates and other structures. I'd like to be able to version control aspects in the CMS including content and channel creation as well as template creation and modification.
I'm not sure why you say that EE is a legacy system, they actually just pushed out their v2.8 a few days ago and have been updating the system for years.
If you're familiar with WordPress, the process really shouldn't be too different. You need to save templates as files and version control those along with system files. You're most likely not going to be version-controlling the database similar to the way you wouldn't be doing that with WordPress.
Simply turning to Google would probably give you hundreds of answers about how to do this but I'll leave you with what I consider to be the most definitive reading on the subject:
http://devot-ee.com/articles/item/version-control-for-expressionengine-using-git-part-1
Have you saved the templates as text files? Once you do that, you can then just backup the template folder. http://ellislab.com/expressionengine/user-guide/templates/templates_as_files.html

How do you take your project from development to production?

Good day to you all,
I am currently developing a project on Laravel. So far I have always developed online, directly editing my files on the webserver throuh FTP (using PSPad or similar simple editing tools).
What I want to do now (and what i believe most people actually do) is setup a (W)LAMP stack on my local machine and program locally. However it is a little bit unclear to me how to keep my local code (including databases) in sync with the live website. How do you folks do that? I know there's probably lots of ways and tools to do that, but what would be your advice for a best practice? Any advice would be very welcome :)
What many companies do is build offline, then push their edits up to a server using git.
Im no expert on the software so ill describe what you do in a basic form:
My advice would be to create an online repo (repository) to store your project while you edit/update.
There are several git project management systems such as github or bitbucket. I personally use bitbucket
What git does, is when you have built or added what you need offline on local (w)lamp, you then git push them up to your repo or server. The changed files then get merged with the existing on the repo or the server. If you'd like the most recent version of your project you'd simply just git pull them down.
Read the full documentation here to see the wide range of options available when using git
We have a settings array within our platform available as $res::Config.
At runtime, a variable is changed from 'dev' to 'live' after checking the HTTP Host, obviously depending on the IP address.
Within our framework bootstrapping, depending on the value of $res::Config->$env, or the environment set previously as either dev or live, the settings for the database connection are set. You store these settings in the Config array as db_live or db_dev.
However you do it, use an environmental variable to figure out whether you want live or dev, and set up and array of settings accordingly.
We also have sandbox and staging for intermittent development stages.
As for version control, use git or subversion.
Edit: It's also possible that within our vhost file, we setup an environmental variable as either live or dev, and our application reads from this accordingly. I'd suggest this approach :)
There are a number of ways of doing this. But this is a deceptively HUGE question you've asked.
Here is some good practice advice - go and research these items, then have a look at my approach.
Typically you use a precess called version control which allows you to create "versions" or snapshots of your system.
The commonly used "SVN" software is good, but the new (not really any more) kid on the block is GIT, and I personally recommend that.
You can use this system to push the codebase live in a controlled fashion. While the files/upload feature is essentially similar to FTP, it allows you to dump a specific version of your site live.
In environments where there are multiple developers, this is ideal - you can compare/test and work around each other, and version control tends to stop errors between devs.
So - advice part 1: Look up and understand version control, then use it to release CODE to the live environment.
Part 2: I use database dumps and farm them back to my machine to work with.
If the live database needs updating, I can work locally and simply export, then re-import on the live system.
For example: on a recent Moodle project I worked on, to refresh the whole database took seconds... I could push a patch and database update in a few minutes.
However: you should think about maintenance and scheduling... if the site is live and has ongoing data changes then you need to be careful with this. Consider adding a maintenance page.
Advice 2: go research SQL dump/export and importing.
I personally use phpmyadmin to dump and re-import, as it's very convenient.
Advice 3: Working locally then pushing live is MUCH BETTER PRACTICE. You're starting down a much safer and better road than you're on!
Hope that helps... but bear in mind - this is a big subject, so you'll need to research a fair bit.

In search of opinions on web based version control systems

Researching various open source, web-based document management/version control systems. I've checked google/questions here, etc...
I'm looking for a lightweight web-based (apache) document mgmt/version control app that runs on top of SVN.
I need to have the ability to:
have multiple users checkin/checkout
have a workflow (when userA checks the file in, and finishes the app passes it to the next person, etc...
the app needs to allow me to have a structure where the files can be moved as a group. the files will be changed on a monthly basis
app needs to have a access/premission control system. some people can see certain files, and perform certain actions on the files
I imagine that I'm going to have 40-50 people dealing with the different files. I imagine that I'm going to have 2000-3000 files that have to be massaged.
I'd prefer that the app be php based if possible, as opposed to a straight java app.
Thanks
I suggest you take a look at Subversion:
WikiPedia: http://en.wikipedia.org/wiki/Subversion_(software)
Mainpage: http://subversion.apache.org.
I honestly don't know if it fits all requirements that you've posted, as I've only used it on projects involving small teams, but you should be able to sort that out by reading the WikiPedia page linked above. That said, it definitely meets the web-dev version control.
A vanilla installation of SVN isn't going to do this; it only does regular version control (commits, branches, etc.). There are plenty of web based svn interfaces, but all they do is give you a way to work with regular svn over the web. The document management features and workflow you require are going to come from some other document management system; I don't know of any that use svn as a back end.
I believe Mercurial provides a web-based interface as well.
For a simplistic, but working version control system made entirely in PHP, built on top of ASVCS, take a look at IntraVersion (http://webscripts.softpedia.com/script/Development-Scripts-js/IntraVersion-39805.html) Not much, but for those stuck like me with no server to host private projects on at the moment, it's a helper.
Have a look at knowledge tree. PHP, open source, with support/hosting available. I've used it in the past. It sucks less than other solutions.

Categories