original_string: static public function add($license) {
          global $DB;
          if ($record = $DB->get_record('license', array('shortname'=>$license->shortname))) {
              // record exists
              if ($record->version < $license->version) {
                  // update license record
                  $license->enabled = $record->enabled;
                  $license->id = $record->id;
                  $DB->update_record('license', $license);
              }
          } else {
              $DB->insert_record('license', $license);
          }
          return true;
      }
code: static public function add($license) {
          global $DB;
          if ($record = $DB->get_record('license', array('shortname'=>$license->shortname))) {
              // record exists
              if ($record->version < $license->version) {
                  // update license record
                  $license->enabled = $record->enabled;
                  $license->id = $record->id;
                  $DB->update_record('license', $license);
              }
          } else {
              $DB->insert_record('license', $license);
          }
          return true;
      }
code_tokens: static public function add ( $ license ) { global $ DB ; if ( $ record = $ DB -> get_record ( 'license' , array ( 'shortname' => $ license -> shortname ) ) ) { // record exists if ( $ record -> version < $ license -> version ) { // update license record $ license -> enabled = $ record -> enabled ; $ license -> id = $ record -> id ; $ DB -> update_record ( 'license' , $ license ) ; } } else { $ DB -> insert_record ( 'license' , $ license ) ; } return true ; }
docstring: Adding a new license type
  @param object $license {
  shortname => string a shortname of license, will be refered by files table[required]
  fullname  => string the fullname of the license [required]
  source => string the homepage of the license type[required]
  enabled => int is it enabled?
  version  => int a version number used by moodle [required]
  }
docstring_tokens: Adding a new license type