# tar -cjf file_aug10.tar.bz2 filename
In the above example command the system would create a tar.bz2 file named home.tar.bz2 in the directory you currently are in of the home directory.
To extract the compress file:
# tar -xjvf file_aug10.tar.bz2
Tuesday, August 31, 2010
How to upgrade Drupal 6.15 to 6.19 ?
Updated patch files to Drupal 6.18/6.19
Standard procedure to upgrade Drupal:
Reference Source:
http://fuerstnet.de/en/drupal-upgrade-easier
.
Standard procedure to upgrade Drupal:
- Download the latest release/patch from drupal.org and follow the included UPGRADE.txt.
**However,for administrators using the UNIX shell it may be easier using the attached patch files below instead of downloading and installing the newest complete Drupal release. - Download the related patch files from here:
http://fuerstnet.de/en/drupal-upgrade-easier - Follow UPGRADING.txt up to '5'.
Let's begin!
1. Back up your Drupal database and site root directory. Be especially sure to back up your "sites" directory which contains your configuration file, added modules and themes, and your site's uploaded files. If other files have modifications, such as .htaccess or robots.txt, back those up as well.
Note: for a single site setup, the configuration file is the "settings.php" file located at sites/default/settings.php. The default.settings.php file contains a clean copy for restoration purposes, if required.
For multisite configurations, the configuration file is located in a
structure like the following:
sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.path/settings.php
More information on multisite configuration is located in INSTALL.txt.
2. If possible, log on as the user with user ID 1, which is the first account created and the main administrator account. User ID 1 will be able to automatically access update.php in step #10. There are special instructions in step #10 if you are unable to log on as user ID 1. Do not close your browser until the final step is complete.
3. Place the site in "Off-line" mode, to let the database updates run without interruption and avoid displaying errors to end users of the site. This option is at http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).
4. If using a custom or contributed theme, switch to a core theme, such as Garland or Bluemarine.
5. Disable all custom and contributed modules. - Remove all of the old files and directories from the Drupal installation directory." Go on using this commands:
cd DRUPAL-ROOT
- Patch:
patch -p1 <>
*
Be warned: this may break your Drupal installation , so make sure to have a backup at hand.
- Proceed with UPGRADING.txt from '8'. Verify the new configuration file to make sure it has the latest and correct information.
8. Copy your backed up "files" and "sites" directories to the Drupal installation directory. If other system files such as .htaccess or robots.txt were customized, re-create the modifications in the new versions of the files using the backups taken in step #1.
9. Verify the new configuration file to make sure it has correct information.
10. Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your Drupal installation's domain name and path). This step will update the core database tables to the new Drupal installation.
Note: if you are unable to access update.php do the following:
- Open your settings.php with a text editor.
- There is a line that says $update_free_access = FALSE;
Change it to $update_free_access = TRUE;
- Once update.php is done, you must change the settings.php file
back to its original form with $update_free_access = FALSE;
11. Ensure that the versions of all custom and contributed modules match the new Drupal version to which you have updated. For a major update, such as from 5.x to 6.x, modules from previous versions will not be compatible and updated versions will be required.
- For contributed modules, check http://drupal.org/project/modules for the version of a module matching your version of Drupal.
- For custom modules, review http://drupal.org/update/modules to ensure that a custom module is compatible with the current version.
12. Re-enable custom and contributed modules and re-run update.php to update custom and contributed database tables.
13. Return the site to its original theme (if you switched to a core theme like Garland or Bluemarine in step #4). If your site uses a custom or contributed theme, make sure it is compatible with your version of Drupal.
- For contributed themes, check http://drupal.org/project/themes for the version of a theme matching your version of Drupal.
- For custom themes, review http://drupal.org/update/theme to ensure that a custom theme is compatible with the current version.
14. Finally, return your site to "Online" mode so your visitors may resume browsing. As in step #3, this option is available in your administration screens at http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).
**WarningIf you get errors like
Reversed (or previously applied) patch detected
or1 out of 2 hunks FAILED
while running the patch dry run (second command above) immediately interrupt patching and upgrade following the steps explained in UPGRADING.txt.
Reference Source:
http://fuerstnet.de/en/drupal-upgrade-easier
.
Tuesday, August 17, 2010
CodeIgniter
Introduction to CodeIgniter
CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task. CodeIgniter (CI) uses the Model-View-Controller (MVC) approach similar to that of Ruby on Rails.
Some people said "Code Igniter is an Open Source Web Application Framework that makes writing kick-ass PHP programs simple as apple pie". Is it true? Lets begin.
1- Download CodeIgniter Current Version from http://codeigniter.com/downloads/
2- Extract the zip file in your root folder in your localhost pc/webserver.
3- Read User Guide or Basic Step on How to use CodeIgniter before you go further in the code.
In my case, I setup xampp server in my local PC.
Next step;
VIEWS
MODELS
O'o... I forgot to copy models file.
In my case, this is models file we always use.
*The class name must same with models file name. In this case, file name is subject_model.php save in C:\xampp\htdocs\form1\system\application\models
Integrate Form with Database.
Task1: Create subject withdraw form for student
Data input: subject code, subject name, reason.
Some people said "Code Igniter is an Open Source Web Application Framework that makes writing kick-ass PHP programs simple as apple pie". Is it true? Lets begin.
1- Download CodeIgniter Current Version from http://codeigniter.com/downloads/
2- Extract the zip file in your root folder in your localhost pc/webserver.
3- Read User Guide or Basic Step on How to use CodeIgniter before you go further in the code.
In my case, I setup xampp server in my local PC.
Next step;
- I extract the codeigniter file insite C:\xampp\htdocs\
- Rename the folder name CodeIgniter to any name you want like form1.
- Inside the form1 folder, there is system and user guide folder, index.php and license.txt file.
- Go inside C:\xampp\htdocs\form1\system\application\config\ and open config.php file. At about line 14 you should see:
$config['base_url'] = "http://www.your-site.com/";
Edit this url with your URL:$config['base_url'] = "http://localhost/form1";
form1 is refer to the folder name in step 2 above. - Now save that file and open autoload.php. On line 42, let’s add the e-mail core class:
$autoload['core'] = array('email');
and database core class:$autoload['libraries'] = array('database');
and on line 54 let’s add the form and url helpers:
$autoload['helper'] = array('url', 'form');
Save that file. The reason for adding the e-mail core class is pretty obvious since one of the features of our registration form is to notify the organizers when someone has submitted a completed form. The database core class is use to interact with database operation.
Controllers
With those core classes and helpers loaded, now the time create my first controller.- Go to C:\xampp\htdocs\form1\system\application\controllers
- You will see sample controller file welcome.php
I copy the file and name it home.php . Open the file and edit the function inside. - This function refer to views file(welcome_message.php) in C:\xampp\htdocs\form1\system\application\views\
function index()
{
$this->load->view('welcome_message');
}
**If I want to create new view files for the form, just rename welcome_message to a new name.Let say subject.function index()
{
$this->load->view('subject');
}
VIEWS
- Go to C:\xampp\htdocs\form1\system\application\views\ and open subject.php
All display setting for my form are formatted in this file. Create the html form here and set the submit function later in controller(home.php). - Open internet browser and type this url to view the page
http://localhost/form1/index.php/home
*home is refer to your controller filename (home.php).
The form will display in your browser as you want.
MODELS
O'o... I forgot to copy models file.
In my case, this is models file we always use.
Open php syntax
class Subject_model extends Model
{
function Subject_model() {
parent::Model();
table_name = 'subject';
}
function check_uid($uid) {
$this->db->where('uid', $uid);
$query = $this->db->get($this->table_name);
return ($query->num_rows() > 0) ? TRUE:FALSE;
}
function check_sem($sem) {
$this->db->where('semester', $sem);
$query = $this->db->get($this->table_name);
return ($query->num_rows() > 0) ? TRUE:FALSE;
}
function check($uid,$sem) {
$this->db->where('uid', $uid);
$this->db->where('semester', $sem);
$query = $this->db->get($this->table_name);
return ($query->num_rows() > 0) ? TRUE:FALSE;
}
function delete($id) {
$this->db->where('id', $id);
$this->db->delete($this->table_name);
return TRUE;
}
function details($uid,$semester) {
$this->db->where('uid', $uid);
$this->db->where('semester', $semester);
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
return $query;
}
else {
return FALSE;
}
}
function details_ref($refno) {
$this->db->where('student_ref_no', $refno);
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
$result = $query->row();
return $result;
}
else {
return FALSE;
}
}
function get_list($currentsem) {
if(!$currentsem) {
$currentsem = '';
}
/*
$this->db->order_by('student_ref_no', 'ASC');
$this->db->order_by('timecreated', 'DESC');
$this->db->order_by('id', 'DESC');
*/
$query = $this->db->query('SELECT *, COUNT(*)-1 as duplicate FROM (SELECT * FROM student '.$currentsem.' ORDER BY id DESC) as student GROUP BY student_ref_no ORDER BY timecreated DESC');
//$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
return $query;
}
else {
return FALSE;
}
}
function count_unique() {
$this->db->group_by('student_ref_no');
$query = $this->db->get($this->table_name);
return $query->num_rows();
}
function get_name($id) {
if(!$id) { return FALSE; }
$this->db->where('id', $id);
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
$result = $query->row();
return $result->student_name;
}
else {
return FALSE;
}
}
function get_latest($limit = NULL, $offset = NULL) {
$this->db->limit($limit, $offset);
$this->db->order_by('date', 'DESC');
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
return $query;
}
else {
return FALSE;
}
}
function insert($data) {
$this->db->set($data);
$this->db->insert($this->table_name);
return $this->db->insert_id();
}
function total() {
$this->db->distinct();
$this->db->select('uid');
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
return $query->num_rows();
}
else {
return FALSE;
}
}
function update($uid,$sem,$data) {
$this->db->where('uid', (string)$uid);
$this->db->where('semester', (string)$sem);
$this->db->set($data);
$this->db->update($this->table_name);
}
function update_student($refno, $data) {
$this->db->where('student_ref_no', $refno);
$this->db->set($data);
$this->db->update($this->table_name);
}
function update_printed($id, $data) {
$this->db->where('id', $id);
$this->db->set($data);
$this->db->update($this->table_name);
}
function get_currentsemester() {
$this->db->distinct();
$this->db->select('currentsemester');
$query = $this->db->get($this->table_name);
if($query->num_rows() > 0) {
return $query;
}
else {
return FALSE;
}
}
}
Close php syntax
*The class name must same with models file name. In this case, file name is subject_model.php save in C:\xampp\htdocs\form1\system\application\models
Integrate Form with Database.
Task1: Create subject withdraw form for student
Data input: subject code, subject name, reason.
- Create blank database using phpmyadmin ()... to be continue
Subscribe to:
Posts (Atom)