original_string: protected function create_file($newrecord) {
          global $DB;
          $newrecord->id = $DB->insert_record('files', $newrecord);
  
          if ($newrecord->filename !== '.') {
              // Callback for file created.
              if ($pluginsfunction = get_plugins_with_function('after_file_created')) {
                  foreach ($pluginsfunction as $plugintype => $plugins) {
                      foreach ($plugins as $pluginfunction) {
                          $pluginfunction($newrecord);
                      }
                  }
              }
          }
      }
code: protected function create_file($newrecord) {
          global $DB;
          $newrecord->id = $DB->insert_record('files', $newrecord);
  
          if ($newrecord->filename !== '.') {
              // Callback for file created.
              if ($pluginsfunction = get_plugins_with_function('after_file_created')) {
                  foreach ($pluginsfunction as $plugintype => $plugins) {
                      foreach ($plugins as $pluginfunction) {
                          $pluginfunction($newrecord);
                      }
                  }
              }
          }
      }
code_tokens: protected function create_file ( $ newrecord ) { global $ DB ; $ newrecord -> id = $ DB -> insert_record ( 'files' , $ newrecord ) ; if ( $ newrecord -> filename !== '.' ) { // Callback for file created. if ( $ pluginsfunction = get_plugins_with_function ( 'after_file_created' ) ) { foreach ( $ pluginsfunction as $ plugintype => $ plugins ) { foreach ( $ plugins as $ pluginfunction ) { $ pluginfunction ( $ newrecord ) ; } } } } }
docstring: Add new file record to database and handle callbacks.
  
  @param stdClass $newrecord
docstring_tokens: Add new file record to database and handle callbacks .