original_string: function check_requisites() {
          global $CFG;
  
          $this->requisitesok = false;
  
      /// Check that everything we need is present
          if (empty($this->sourcebase) || empty($this->zipfilename)) {
              $this->errorstring='missingrequiredfield';
              return false;
          }
      /// Check for correct sourcebase (this will be out in the future)
          if (!PHPUNIT_TEST and $this->sourcebase != 'https://download.moodle.org') {
              $this->errorstring='wrongsourcebase';
              return false;
          }
      /// Check the zip file is a correct one (by extension)
          if (stripos($this->zipfilename, '.zip') === false) {
              $this->errorstring='wrongzipfilename';
              return false;
          }
      /// Check that exists under dataroot
          if (!empty($this->destpath)) {
              if (!file_exists($CFG->dataroot.'/'.$this->destpath)) {
                  $this->errorstring='wrongdestpath';
                  return false;
              }
          }
      /// Calculate the componentname
          $pos = stripos($this->zipfilename, '.zip');
          $this->componentname = substr($this->zipfilename, 0, $pos);
      /// Calculate md5filename if it's empty
          if (empty($this->md5filename)) {
              $this->md5filename = $this->componentname.'.md5';
          }
      /// Set the requisites passed flag
          $this->requisitesok = true;
          return true;
      }
code: function check_requisites() {
          global $CFG;
  
          $this->requisitesok = false;
  
      /// Check that everything we need is present
          if (empty($this->sourcebase) || empty($this->zipfilename)) {
              $this->errorstring='missingrequiredfield';
              return false;
          }
      /// Check for correct sourcebase (this will be out in the future)
          if (!PHPUNIT_TEST and $this->sourcebase != 'https://download.moodle.org') {
              $this->errorstring='wrongsourcebase';
              return false;
          }
      /// Check the zip file is a correct one (by extension)
          if (stripos($this->zipfilename, '.zip') === false) {
              $this->errorstring='wrongzipfilename';
              return false;
          }
      /// Check that exists under dataroot
          if (!empty($this->destpath)) {
              if (!file_exists($CFG->dataroot.'/'.$this->destpath)) {
                  $this->errorstring='wrongdestpath';
                  return false;
              }
          }
      /// Calculate the componentname
          $pos = stripos($this->zipfilename, '.zip');
          $this->componentname = substr($this->zipfilename, 0, $pos);
      /// Calculate md5filename if it's empty
          if (empty($this->md5filename)) {
              $this->md5filename = $this->componentname.'.md5';
          }
      /// Set the requisites passed flag
          $this->requisitesok = true;
          return true;
      }
code_tokens: function check_requisites ( ) { global $ CFG ; $ this -> requisitesok = false ; /// Check that everything we need is present if ( empty ( $ this -> sourcebase ) || empty ( $ this -> zipfilename ) ) { $ this -> errorstring = 'missingrequiredfield' ; return false ; } /// Check for correct sourcebase (this will be out in the future) if ( ! PHPUNIT_TEST and $ this -> sourcebase != 'https://download.moodle.org' ) { $ this -> errorstring = 'wrongsourcebase' ; return false ; } /// Check the zip file is a correct one (by extension) if ( stripos ( $ this -> zipfilename , '.zip' ) === false ) { $ this -> errorstring = 'wrongzipfilename' ; return false ; } /// Check that exists under dataroot if ( ! empty ( $ this -> destpath ) ) { if ( ! file_exists ( $ CFG -> dataroot . '/' . $ this -> destpath ) ) { $ this -> errorstring = 'wrongdestpath' ; return false ; } } /// Calculate the componentname $ pos = stripos ( $ this -> zipfilename , '.zip' ) ; $ this -> componentname = substr ( $ this -> zipfilename , 0 , $ pos ) ; /// Calculate md5filename if it's empty if ( empty ( $ this -> md5filename ) ) { $ this -> md5filename = $ this -> componentname . '.md5' ; } /// Set the requisites passed flag $ this -> requisitesok = true ; return true ; }
docstring: This function will check if everything is properly set to begin
  one installation. Also, it will check for required settings
  and will fill everything as needed.
  
  @global object
  @return boolean true/false (plus detailed error in errorstring)
docstring_tokens: This function will check if everything is properly set to begin one installation . Also it will check for required settings and will fill everything as needed .