Friday, June 27, 2014

Adopt PHP Library in Codeigniter

Adopt PHP Library:

1. Create a test folder in it:

/application/libraries/test_folder/

2. Create a Test_lib.php in the libraries root with the content:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once 'facebook/facebook.php';

class Facebook_lib extends Facebook{
}



3. In controller:

$this->load->library('facebook_lib',$config); 

$this->facebook_lib->clearAllPersistentData();




Friday, June 13, 2014

Getting Git on Server

Getting Git on Server:

In order to initially set up any Git server, you have to export an existing repository into a new bare repository.

git clone path_of_my_project.git
Initialized empty Git repository in /opt/path_of_project.git

The output for this command is a little confusing. Because clone is basically a git init and then a git fetch, you see some output from the git init part, which creates an empty directory. The actual object transfer gives no output, but it does happen. You should now have a copy of the Git directory data in your my_project.git directory.

This is roughly equivalent to something like

cp -Rf my_project/.git my_project.git

Putting Bare Repository on server:

Let’s say you’ve set up a server called git.example.com that you have
SSH access to, and you want to store all your Git repositories under the /opt/git directory.
You can set up your new repository by copying your bare repository over:

scp -r my_project.git user@git.example.com:/opt/git

we can clone repository by this

git clone user@git.example.com:/opt/git/my_project.git

Friday, June 6, 2014

Git Daemon

Git Daemon:

Git daemon allows users to share the own repository to colleagues quickly. Git instaweb allows users to provide web view to the repository.

Git protocol is relatively easy to set up. Basically, you need to run this command in a daemonized manner:

git daemon --reuseaddr --base-path=/opt/git/ /opt/git/

--reuseaddr allows the server to restart without waiting for old connections to time out, the --base-path option allows people to clone projects without specifying the entire path, and the path at the end tells the Git daemon where to look for repositories to export. If you’re running a firewall, you also need to punch a hole in it at port 9418 on the box you’re setting this up on.

/etc/event.d/local-git-daemon

script:

start on startup
stop on shutdown
exec /usr/bin/git daemon \
      --user=git --group=git \
      --reuseaddr \
      --base-path=/opt/git/ \
      /opt/git/
respawn