Archive

Archive for April, 2012

The Drupal 6 bootstrap easy debug

Just as a self reminder, and because I don’t fancy too much looking into the Drupal core for debugging, here is a short explanation of how the Drupal 7 bootstrap mechanism works.

First of all, a bootstrap mechanism is a mechanism by which you work progressively your way through the full loading of a system, step by step, starting with the loading of simple elements that will allow you to load more complex elements. The Linux system also has a bootstrap mechanism (as do most OSes). For operating systems, bootstrapping means you first load a little bit of code which will enable the computer to know how to deal with memory and compiled code, which then allows you to load the Linux kernel, which then allows you to load (and executre) much more stuff, like your desktop interface, etc.

So in Drupal, as you might have realized, everything goes through the /index.php file, which looks like this:

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}

drupal_page_footer();

We are only interested in the first bit here (the bootstrap):

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

This bit literally tells us “load the bootstrap library” then “call the bootstrap mechanism with the level of bootstrap DRUPAL_BOOTSTRAP_FULL”.

For practical reasons, the DRUPAL_BOOTSTRAP_FULL constant’s value is actually 8, but it is called DRUPAL_BOOTSTRAP_FULL to make it more human. Incidentally, this constant is defined at the beginning of the included file “bootstrap.inc”.

Now as you see we wall the drupal_bootstrap() function, also located in bootstrap.inc (quite down the file, at line 1305). Let’s see what it does.

function drupal_bootstrap($phase) {
  static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), 
    $phase_index = 0;

  while ($phase >= $phase_index && isset($phases[$phase_index])) {
    $current_phase = $phases[$phase_index];
    unset($phases[$phase_index++]);
    _drupal_bootstrap($current_phase);
  }
}

As we can see here, we prepare an array of “steps”. Because of the definition of each of the constants used here, this array is actually: $phases[0=>0,1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8], 8 being DRUPAL_BOOTSTRAP_FULL as we have seen previously.

So when calling this function, the index.php calls it with the value 8. The while condition that follows says this:

While 8 is greater than the $phase_index (initially 0) and while there is a value for the $phases array element with index of $phase_index set $current_phase to the current $phase_index unset the element of the $phases array that has the index of $phase_index AND increase $phase_index (so the next iteration executes the next $phases array element) call the _drupal_bootstrap() function with the $current_phase (0 in the first case, then 1, then 2, etc up to 8) 

So the idea is that drupal_bootstrap() is the progressive mechanism that makes several levels of bootstrap execute.

If we move to the next step (the _drupal_bootstrap() function), we see the following structure:

  switch ($phase) {

    case DRUPAL_BOOTSTRAP_CONFIGURATION:
      drupal_unset_globals();
      timer_start('page');
      conf_init();
      break;

    case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
      require_once variable_get('cache_inc', './includes/cache.inc');
      if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) {
        exit;
      }
      break;

    case DRUPAL_BOOTSTRAP_DATABASE:
      ...

So we are indeed simply executing a separate bit of code for each level of the bootstrap of Drupal.

Sometimes you might have problems ocurring during any phase of the bootstrap. To help you identify which step is broken, one (quite extreme – don’t use in production) method is to add calls to the die() function in any of these steps, and see if your drupal page prints the message you give into the die() call.

For example, to hack the first level:

    case DRUPAL_BOOTSTRAP_CONFIGURATION:
      drupal_unset_globals();
      die('called drupal_unset_globals() successfully');
      timer_start('page');
      conf_init();
      break;

This type of construction will fail after calling drupal_unset_globals(), but if you used to have a blank screen, you will now get an error message that tells you that the previous step worked. And you can thus work your way down the bootstrap in much the same way:

    case DRUPAL_BOOTSTRAP_CONFIGURATION:
      drupal_unset_globals();
      timer_start('page');
      conf_init();
      die('called conf_init() successfully');
      break;

Once you really get a blank screen again, you know that the previous step failed. You have thus got much closer from the real problem. The next step would then be to get into the last function called and use the die() technique again.

If you want to do that on a production server, use error_log() instead of die(). This will not show anything on your web page but it will register it in your Apache (or other web server) error log (generally something like /var/log/apache2|httpd/error_log), which will let your normal users use other parts of the website without realizing you are debugging, but still let you debug.

I hope this might have helped some of you starting with Drupal development/debugging. Don’t hesitate to leave me a message if it did, I appreciate it.

      die('called drupal_unset_globals() successfully');
Advertisements

Problemas al crear cursos en chamilo despues de una instalación – ERROR 500

April 21, 2012 49 comments

Hola a todos,

Me acaban de llamar y escribir para reportarme un error que es común cuando se hace una instalación de la plataforma Chamilo 1.8.4.2 en un hosting y para no volverlo a repetir o tener problemas, por que no estoy disponible. Informo y detallo el error y la solución:

ERROR 500

Este usuario ha instalado su plataforma, pero al crear un curso le muestra este error:

SOLUCIÓN:

Paso 1: Ingresar como administrador al portal

Paso 2: Ingresar a la pestaña de: Administrador > Parámetros de Configuración de la Plataforma > Seguridad

Paso 3:  Buscar dentro de la configuración “Seguridad”

  • Permisos para los nuevos directorios (0777)
  • Permisos para los nuevos archivos (0666)

Paso 4 :Cambiar los permisos de seguridad:

  • Permisos para los nuevos directorios (0755)
  • Permisos para los nuevos archivos (0644)

Guardar configuración y Listo!  :)

Nota: Este arreglo sera visible solo para los nuevos cursos (cursos creados después del arreglo), cursos (antes del arreglo) tienen que ser eliminados y creados otra vez.

 

Chamilo 1 “LMS”, Chamilo 2 “LCMS Connect”, and the desambiguation

There’s been much talk over the last years about Chamilo 1 and 2, whether they were the same product, whether we were going to merge, etc.

Last month’s General Assembly of the Chamilo Association (which also made me the happy president of the association) helped us clarify a common line of conduct which, I am sure, most will appreciate.

If you’re in a hurry, you’d better move directly to the end of this article (“Conclusion”), because I want to drive you through the history of both projects now to give you a complete understanding of both pieces of software.

History of Chamilo 1 (now Chamilo LMS)

Chamilo LMS’s code starts to be written in 2001. A little before the first traces you might find about Moodle, so yes, in a way Chamilo is the older brother of Moodle (how about that, now?). It is born in the Université Catholique de Louvain as the Claroline project.

In 2004, one of the founders of the Claroline project decides to fork the software to give it a increased focus on businesses, and launches the D0keos company. It could have been the Claroline company, launched as a spin-up of the university, but for human reasons it was not something the different people involved agreed on, so the new D0keos project was born, and an infamous e-mail was sent by the new D0keos founder to all the Claroline community, stating that “The Claroline project is dead, long live D0keos” (which was, obviously, not true – Claroline still lives today).

The software (which is still the basis of Chamilo LMS) continued to be developed, with many changes and improvements, until 2009. During that period, the D0keos tried (but somehow failed, otherwise I wouldn’t be writing all this) to develop a spirit of community. Somehow, it partially reached that objective, with a considerable involvement of mine, but decisions taken by the head of the company had the particular characteristic of pissing the community off and in 2008 it started using the nerves of the business partners as well, until in 2009, most of them (community and partners) decided the continuous lack of consistency in the lead’s actions and opinions should stop affecting the software, the community and the businesses of his partners, and decided to launch Chamilo (in early 2010, although the decision had already been taken by the end of 2009).

Since then, and in only 2 years time, without external funding, the Chamilo community has grown to 1 million users worldwide, pretty much the same results as D0kkeos in 5 years time, albeit with a more widespread internet connectivity.

As you understand, this project (Chamilo LMS) is using the same codebase as in 2001 and shares many elements with the Claroline and the D0keos projects, but has since then been reworked to include many practical Web 2.0 tools for the teachers, which make his work much easier today. It has also received many SCORM improvements, tracking fixes and social networks integrations, altogether keeping the previous visual structure which make it possible for organizations to migrate easily from one version to another, without having to train their teachers again. Many aspects of the backend have been optimized (the next version comes with huge database structure improvements and great security filters which don’t prevent the teachers from doing their work).

Chamilo LMS is the one used on https://campus.chamilo.org and chances are that if someones tells you about Chamilo, they’re talking about this version. It represents 98% of our user base (of our community) in 2014.

Definitely, you could say that Chamilo LMS is a project that built its features for the masses, providing great tools, with great reliability and security, and that is continuing to improve by the day (I just checked and we have had 900 changes in the code in the last 30 days…).

So while the 2.0 (or as we will see, the “LCMS Connect”) project exists, Chamilo LMS will continue being developed at least for the next two years (and there will be support for it at least for the next 4 years, so fear not).

Chamilo LMS’s development is managed by companies spread over Belgium, Spain and Perú, and backed up by the universities of Grenoble (France), Pau (France), Carlos II (Spain), Genève (Switzerland), Tocantíns (Brazil) and San Ignacio de Loyola (Peru).

History of Chamilo 2 (now Chamilo LCMS Connect)

Chamilo 2, or at least its concept, was first designed in 2006 by a team of (mostly Belgian, as was Claroline) university teachers and students as a way to redesign D0keos and increase its flexibility. It was, at the time, thought to become, at some point, D0keos 1.7 (the current version was 1.6). However, due to the innovative nature of the project (and its development team) and the little resources assigned to its development, the project soon felt into dismay and, two years later (2007), as the mainstream project released a new major version (called 1.8), it was decided the project would be reviewed and relaunched as D0keos 1.9.

Sadly, the same fate stroke D0keos 1.9 and it was never actually released. In late 2008, it was decided the project would embark more redesign and be coined D0keos 2.0. Before this version was out, a split occured and the Chamilo project was decided to be launched, with the expectation that what had been developed until then as D0keos 2.0 would be released as Chamilo (the first ever real version of the software to be released).

However, because of a lack of resources again, the team could not deliver and it was decided that, on the 18th of January 2010, the Chamilo project would be announced to the public with version Chamilo 1.8.6.2, which was the continuation of the D0keos project, as a way to give Chamilo 2.0 more time to get ready. Being two different software bases, it is currently too difficult for both development teams to join efforts without loosing months of work and thus affecting you, the users.

In December 2010, Chamilo 2.0 was released as a first stable version, but many reported that, although the features it offered were certainly interesting, it still lacked the usability of Chamilo 1.8, and we temporarily decided to stop promoting 2.0 so that the team could focus on a better released. This is how Chamilo 2.1 came to be in January 2012, which was more stable.

Chamilo LCMS Connect’s development is mostly coordinated by the Hoogeschool University College of Gent, Artevelde Hoogeschool, Erasmus Hoogeschool and Vrije Universiteit of Brussels (all of them in Belgium, all of them mainly Flemish-speaking academical institutions).

Although the original idea was to redesign the whole software and enjoy the usefulness of object-oriented programming from the ground up, a series of untimely or inadequate decisions have slowed down the development of LCMS and its reaching maturity. A few of these:

  • (too) early split of the code into one core and about 50 “modules”, which in consequence are not ideally maintained, generating a series of commits that should logically only be made at the top level of the inheritance schema, but that need to be “propagated” to about 50 modules
  • lacking documentation and very high complexity of the code structure, making it complicated to delve into in less than a full-time week, and very complicated to master in less than a few months (most of new Chamilo LMS developers get their first hack ready in less than a day)
  • badly known history of the project, leading to late major rewrite of the database layer (already resolved in 2009, but still surprising at the time)
  • no decision taken, nor priority set on how to manage translations in order to allow for external translators (without developers knowledge) to contribute (that’s an issue since 2010, and still is in 2014)

Apart from these, the progress has been taking up speed since the integration as an important part of the team of Koen Favere, a technologically savvy teacher in one of the academies involved, who saw the sheer necessity of better communication and respect between the different development teams and between developers and teachers (the main users of such systems). Since then, the coordination of developments has taken shape and progress is finally percievable.

Lately, with Chamilo LCMS version 4, the system is more stable and the major issues are still its complexity (both at user level and at development level). Chamiluda 2013 and the presence of teachers members of the community has helped me understand that there is a market for such complex solutions, albeit very specific to high-end education environment (in my view only available to a very little minority, still). For those wanting to have highly customizable solutions with the possibility to integrate content from several different sources (what Blackboard calls its “mashups”), LCMS is definitely worth a run!

Conclusion

Because of the numbering in the versions (Chamilo 1 & Chamilo 2), people tend to be *very confused* (and this is an understatement) about the drastic changes of interface, the lack of translations to other languages than English and Dutch of LCMS (being worked on for the last 2 years without much results, I must say) and the missing features in comparison to version 1.8.8.4. This worries most of our users.

Well, that’s because these really are two, completely different pieces of software, developed by different teams (although they are in active communication to share best practices and decisions) for different environments. Although the objective of version 2 was to make things so flexible we could reach different environments with the same software, it still needs a little bit of time to get there.

During the 2012 General Assembly, it was made clear that our goals (as two different teams) were still different, and we thus decided it was time to remove the ambiguous character of that naming mistake we did 2 years before.

What was previously known as Chamilo 1 will now be officially named Chamilo LMS, and Chamilo LCMS Connect will be the name of the parallel project which was previously called Chamilo 2.1.

This will soon show up on our website, as long as a set of characteristics for each, so people understand better what they’re getting out of the Chamilo project, be it through Chamilo LMS or Chamilo LCMS Connect.

Also, decisions have now been taken in common by the two teams to move towards a slow integration by re-using the same pieces of software at the core of both applications. This should vastly benefit the implementors of Chamilo as we will re-use more pieces of the Symfony framework, which means people working with Symfony directly or with other pieces of software using pieces of Symfony themselves (like Drupal 8) will be more easily able to tune Chamilo to their needs in the future.

As a reminder, Chamilo differs greatly from its predecessors though three very important decisions:

  • the trademark is owned by a non-profit association, governed by 5 different people of various countries and activities
  • official providers can only become providers once they have contributed something, which means they will be much more likely to contribute in the future (the learning curve is acquired since the very start)
  • official providers have to pass an exam, which includes understanding what free software means for their business

You can contact the Chamilo Association at any time at info_at_chamilo.org for more information about the project, or BeezNest (official provider) for quotes at sales@beeznest.com

Chamilo certification program

This is still under construction, but some of the certification exams are already ready to be taken. We expect the following levels of certification to be available to the Chamilo community through Latinux online tests for the most basic, and through an official Latinux center for the more advanced ones.

For teachers:

  • Certified Chamilo LMS Course Builder (CCHACB, or CHACOBU)
  • Certified Chamilo lms Course Teacher (CCHACT, or CHACOTE)
  • Certified Chamilo lms Course Specialist (CCHACS, or CHACOS)

For admins:

  • Certified Chamilo lms Portal Assistant (CCHAPA)
  • Certified Chamilo lms Portal Builder (CCHAPB)
  • Certified Chamilo lms Portal Specialist (CCHAPS)
%d bloggers like this: