Showing posts with label cms. Show all posts
Showing posts with label cms. Show all posts

Wednesday, September 22, 2010

Drush command line shell and scripting interface for Drupal

I haven't heard about Drush command line tool until recently. Books about Drupal do not talk about this nifty tool, not even the advanced ones. Drush takes the power of command line, it can be savior for lazy hacker like me. The only prerequisite for using drush is secure shell access to execute commands on your web server server.

First thing I learnt to do with drush is download, upgrade and enable modules. It a quick and efficient way of upgrade modules.


# /usr/share/drush/drush disable link
The following modules will be disabled: link
Do you really want to continue? (y/n): y
Link was disabled successfully.                                                                                                                   [ok]
# /usr/share/drush/drush uninstall link
The following modules will be uninstalled: link
Do you really want to continue? (y/n): y
link was successfully uninstalled.                                                                                                                [ok]
# /usr/share/drush/drush dl link
Project link (6.x-2.9) downloaded to /var/www/drupal/sites/all/modules/.                                                                        [success]
# /usr/share/drush/drush enable link
The following modules will be enabled: link
Do you really want to continue? (y/n): y
Link was enabled successfully.       

Another favorite feature of drush is ability to execute sql commands to debug problems. /usr/share/drush/drush sql cli

Learn more about the various options and rediscover of the joy of Drupal.

Friday, August 22, 2008

Using Wordpress plugins safely

Most often people tend to try out a lot of plugins while customizing their Wordpress CMS. While they keep some most of them are disabled from plugin management panel in wordpress dashboard or just deleted from the wordpress plugins directory forgetting that it has been included it the template files. Sometimes plugins break between upgrades too. If you are customizing wordpress for a client you don't want him breathing down your neck about the pages not loading properly. Better be safe than sorry, always call the wordpress plugins the right way. if (function_exists('some-wp-plugin')) { some-wp-plugin(); }

Thursday, January 31, 2008

Logging PHPnuke Database Connection Failures

Find the db/db.php file in your PHPnuke installation and insert the error_log line.

if(!$db->db_connect_id) { die(”<br><br><center><img src=images/logo.gif><br><br><b>There seems to be a problem with the $dbtype server, sorry for the inconvenience.<br><br>We should be back shortly.</center></b>”);
}

Now the last lines of the db/db.php file should look like this. The error_log simply logs the errors into /home/foo-joe/logs/db_log, you should change this to reflect your directory structure.

if(!$db->db_connect_id) {
error_log(”[”.date(“D M d Y h:iA”).”] Failed to serve request for page ‘”. $_SERVER[‘REQUEST_URI’].”’ from ‘”.$_SERVER[‘REMOTE_ADDR’].”’ using browser ‘”. $_SERVER[‘HTTP_USER_AGENT’].”’\n”,3,”/home/foo-joe/logs/db_log”); die(”“<br><br><center><img src=images/logo.gif><br><br><b>There seems to be a problem with the $dbtype server, sorry for the inconvenience.<br><br>We should be back shortly.</center></b>”);
}

Refer to error_log PHP manual page for more information and PHPnuke documentation on error logging and database calls, Please note this is for debugging purpose only.

Popular Posts