Example #1
0
 /**
  * Check if unoconv configured path is correct and working.
  *
  * @return \stdClass an object with the test status and the UNOCONVPATH_ constant message.
  */
 public static function test_unoconv_path()
 {
     global $CFG;
     $unoconvpath = $CFG->pathtounoconv;
     $ret = new \stdClass();
     $ret->status = self::UNOCONVPATH_OK;
     $ret->message = null;
     if (empty($unoconvpath)) {
         $ret->status = self::UNOCONVPATH_EMPTY;
         return $ret;
     }
     if (!file_exists($unoconvpath)) {
         $ret->status = self::UNOCONVPATH_DOESNOTEXIST;
         return $ret;
     }
     if (is_dir($unoconvpath)) {
         $ret->status = self::UNOCONVPATH_ISDIR;
         return $ret;
     }
     if (!file_is_executable($unoconvpath)) {
         $ret->status = self::UNOCONVPATH_NOTEXECUTABLE;
         return $ret;
     }
     if (!\file_storage::can_convert_documents()) {
         $ret->status = self::UNOCONVPATH_VERSIONNOTSUPPORTED;
         return $ret;
     }
     return $ret;
 }