Disable and enable CakePHP plugins on the fly

I am currently working on a rather large project which is based on CakePHP framework.  In order to simplify the task, I’ve broken down the whole application into a number of CakePHP plugins.  Now, however, I want to enable/disable plugins on the fly.  After a brief search around I couldn’t find how to do that.  Asking a question at #cakephp IRC channel did it.  RabidFire instantly replied with the link that gave me an idea.   30 seconds later I had a working solution.

CakePHP plugins extend AppController.  So all that one needs to do is add the following lines to app/app_controller.php (Using CakePHP 2.0, but it’s trivial to adopt for earlier versions):

public function beforeFilter() {
    $allowedPlugins = array('crm', 'articles');
    if (!empty($this->request->params['plugin']) && !in_array($this->request->params['plugin'], $allowedPlugins)) {
        throw new ForbiddenException();
    }
}

Upgrading to PHP 5.2.x on CentOS

Today while setting up yet another project on my hosting server.  The server runs CentOS 5.6, which means PHP 5.1.6 is used.  However the new project required PHP 5.2.0+.  It turned out upgrading PHP is trivial.  There is even a Howto Guide in CentOS wiki.  The steps are:

  1. Add CentOS Testing repository to yum.
  2. yum update PHP packages.

That’s all folks!

No more Cyprus ID cards for foreigners. What’s the problem?

For the last few days I keep hearing and reading about this bit of news:

FOREIGN nationals are no longer being issued a Cyprus ID card, a decision implemented islandwide last Friday without explanation or notification from the Interior Ministry.

I do understand that Cyprus ID card is a handy thing to have.  But I don’t see what’s the big problem about not having it is anyway.  I’m a Cypriot now and I do have an ID card, but I lived in this country for ten years without having one, and I never knew I had a problem.

First of all, Cyprus is not some weird police state.  One doesn’t have to prove his or her identity every day to anyone.  Nobody is policing the street, stopping random passers-by with routine identity checks.  The proof of identity is needed mostly when working with government and financial offices.   With online banking and JCC online payments is there really someone who goes to the bank on a daily basis? Except bank employees of course.  I don’t think so.

Secondly, Cyprus is a country with very weak public transport network.  So almost everyone, if not everyone, drives a car.  And if one drives a car, I think it’s safe to assume that driving license is not too far away.  Cyprus driving license is not the most compactest of things and certainly not the most convenient to carry around.  But I think it works well given how (not) far most people get from their vehicles.

Thirdly, I think having Cyprus ID cards only for Cypriots makes a lot of sense.  I’ve seen it more than once when non-citizens pass as citizens just because they have a Cyprus ID card.   Yes, not everyone turns it around to check for citizenship/nationality.

Fourthly, I’m sure that the majority of complaining people are British expats, who are used to much higher living conditions (including a working government) than most other expats and country guests.  The problem is not as big as they are trying to make it.  No offense intended.