original_string: public static function rewaken_object($id) {
          global $DB, $CFG;
          require_once($CFG->libdir . '/filelib.php');
          require_once($CFG->libdir . '/portfolio/exporter.php');
          require_once($CFG->libdir . '/portfolio/caller.php');
          require_once($CFG->libdir . '/portfolio/plugin.php');
          if (!$data = $DB->get_record('portfolio_tempdata', array('id' => $id))) {
              // maybe it's been finished already by a pull plugin
              // so look in the logs
              if ($log = $DB->get_record('portfolio_log', array('tempdataid' => $id))) {
                  self::print_cleaned_export($log);
              }
              throw new portfolio_exception('invalidtempid', 'portfolio');
          }
          $exporter = unserialize(base64_decode($data->data));
          if ($exporter->instancefile) {
              require_once($CFG->dirroot . '/' . $exporter->instancefile);
          }
          if (!empty($exporter->callerfile)) {
              portfolio_include_callback_file($exporter->callerfile);
          } else if (!empty($exporter->callercomponent)) {
              portfolio_include_callback_file($exporter->callercomponent);
          } else {
              return; // Should never get here!
          }
  
          $exporter = unserialize(serialize($exporter));
          if (!$exporter->get('id')) {
              // workaround for weird case
              // where the id doesn't get saved between a new insert
              // and the subsequent call that sets this field in the serialised data
              $exporter->set('id', $id);
              $exporter->save();
          }
          return $exporter;
      }
code: public static function rewaken_object($id) {
          global $DB, $CFG;
          require_once($CFG->libdir . '/filelib.php');
          require_once($CFG->libdir . '/portfolio/exporter.php');
          require_once($CFG->libdir . '/portfolio/caller.php');
          require_once($CFG->libdir . '/portfolio/plugin.php');
          if (!$data = $DB->get_record('portfolio_tempdata', array('id' => $id))) {
              // maybe it's been finished already by a pull plugin
              // so look in the logs
              if ($log = $DB->get_record('portfolio_log', array('tempdataid' => $id))) {
                  self::print_cleaned_export($log);
              }
              throw new portfolio_exception('invalidtempid', 'portfolio');
          }
          $exporter = unserialize(base64_decode($data->data));
          if ($exporter->instancefile) {
              require_once($CFG->dirroot . '/' . $exporter->instancefile);
          }
          if (!empty($exporter->callerfile)) {
              portfolio_include_callback_file($exporter->callerfile);
          } else if (!empty($exporter->callercomponent)) {
              portfolio_include_callback_file($exporter->callercomponent);
          } else {
              return; // Should never get here!
          }
  
          $exporter = unserialize(serialize($exporter));
          if (!$exporter->get('id')) {
              // workaround for weird case
              // where the id doesn't get saved between a new insert
              // and the subsequent call that sets this field in the serialised data
              $exporter->set('id', $id);
              $exporter->save();
          }
          return $exporter;
      }
code_tokens: public static function rewaken_object ( $ id ) { global $ DB , $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/exporter.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/caller.php' ) ; require_once ( $ CFG -> libdir . '/portfolio/plugin.php' ) ; if ( ! $ data = $ DB -> get_record ( 'portfolio_tempdata' , array ( 'id' => $ id ) ) ) { // maybe it's been finished already by a pull plugin // so look in the logs if ( $ log = $ DB -> get_record ( 'portfolio_log' , array ( 'tempdataid' => $ id ) ) ) { self :: print_cleaned_export ( $ log ) ; } throw new portfolio_exception ( 'invalidtempid' , 'portfolio' ) ; } $ exporter = unserialize ( base64_decode ( $ data -> data ) ) ; if ( $ exporter -> instancefile ) { require_once ( $ CFG -> dirroot . '/' . $ exporter -> instancefile ) ; } if ( ! empty ( $ exporter -> callerfile ) ) { portfolio_include_callback_file ( $ exporter -> callerfile ) ; } else if ( ! empty ( $ exporter -> callercomponent ) ) { portfolio_include_callback_file ( $ exporter -> callercomponent ) ; } else { return ; // Should never get here! } $ exporter = unserialize ( serialize ( $ exporter ) ) ; if ( ! $ exporter -> get ( 'id' ) ) { // workaround for weird case // where the id doesn't get saved between a new insert // and the subsequent call that sets this field in the serialised data $ exporter -> set ( 'id' , $ id ) ; $ exporter -> save ( ) ; } return $ exporter ; }
docstring: Rewakens the data from the database given the id.
  Makes sure to load the required files with the class definitions
  
  @param int $id id of data
  @return portfolio_exporter
docstring_tokens: Rewakens the data from the database given the id . Makes sure to load the required files with the class definitions