Actions

Question signature

From LimeSurvey Manual

Question signature

Since question types can no longer be uniquely identified by their object names, we have created a signature scheme.

While in a single limesurvey instance question objects must be uniquely named, there might be different plugins defining the question objects with the same name.

To make sure we can identify what the type of a question is, we derive a unique identifier (GUID) from a signature.

Each question object MUST therefore define a protected static $signature field. This field is used to derive the signature using a hashing approach.

It is the developer's task to make this signature as unique as possible, yet, it MUST never change. If the signature of a question object changes it is recognized as a new question type, while this is not necessarily a problem, the fact that the old question type is no longer available is. Since LimeSurvey cannot find the old question type it will not be able to execute, import, or maybe even edit, surveys containing this now unknown question type.

An example of a signature is shown below:

protected static $signature = array(

   'orignalAuthor' => 'Sam Mousa',

   'originalName' => 'Yes / No',

   'startDev' => '2013-30-1'

);

Note that you are free to use any format / data type you want. The GUID is derived using the following code:

/**
* This function derives a unique identifier for identifying a question type.
*/

public static function getGUID()

{

   // We use json_encode because it is faster than serialize.

   return md5(json_encode(static::$signature));

}