system/modules/DocumentManagementSystem/config/initialize.php
private function initSystemSettings()
  {
    if (\Config::get(self::DMS_BASE_DIRECTORY_KEY) && \Config::get(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY))
    {
      return;
    }
    
    \System::log('Running init script for setting default DMS settings, if missing.', __METHOD__, TL_CONFIGURATION);
    
    if (!\Config::get(self::DMS_BASE_DIRECTORY_KEY))
    {
      \System::log('Setting default DMS base directory to "' . $this->getDmsBaseDirectory() . '".', __METHOD__, TL_CONFIGURATION);
      
      $uuid = null;
      
      $objDatabase = \Database::getInstance();
      $objDir = $objDatabase->prepare("SELECT * FROM tl_files WHERE path=?")
              ->limit(1)
              ->execute($this->getDmsBaseDirectory());
      
      if ($objDir->next())
      {
        $uuid = \StringUtil::binToUuid($objDir->uuid);
      }
      
      if ($uuid == null)
      {
        if (file_exists(TL_ROOT . '/' . $this->getDmsBaseDirectory()))
        {
          $objDir = \Dbafs::addResource($this->getDmsBaseDirectory());
          $uuid = \StringUtil::binToUuid($objDir->uuid);
        }
        else
        {
          \System::log('Initialization of system setting for DMS failed, because default base directory does not exists.', __METHOD__, TL_ERROR);
          return;
        }
      }
      
      if ($uuid != null)
      {
        \Config::persist(self::DMS_BASE_DIRECTORY_KEY, $uuid);
      }
    }
    
    if (!\Config::get(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY))
    {
      \System::log('Setting default DMS max. upload file size to "5 MB".', __METHOD__, TL_CONFIGURATION);
      \Config::persist(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY, serialize(self::DMS_MAX_UPLOAD_FILE_SIZE_VALUE));
    }
  }
private function initSystemSettings()
  {
    if (\Config::get(self::DMS_BASE_DIRECTORY_KEY) && \Config::get(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY))
    {
      return;
    }
    
    \System::log('Running init script for setting default DMS settings, if missing.', __METHOD__, TL_CONFIGURATION);
    
    if (!\Config::get(self::DMS_BASE_DIRECTORY_KEY))
    {
      \System::log('Setting default DMS base directory to "' . $this->getDmsBaseDirectory() . '".', __METHOD__, TL_CONFIGURATION);
      
      $uuid = null;
      
      $objDatabase = \Database::getInstance();
      $objDir = $objDatabase->prepare("SELECT * FROM tl_files WHERE path=?")
              ->limit(1)
              ->execute($this->getDmsBaseDirectory());
      
      if ($objDir->next())
      {
        $uuid = \StringUtil::binToUuid($objDir->uuid);
      }
      
      if ($uuid == null)
      {
        if (file_exists(TL_ROOT . '/' . $this->getDmsBaseDirectory()))
        {
          $objDir = \Dbafs::addResource($this->getDmsBaseDirectory());
          $uuid = \StringUtil::binToUuid($objDir->uuid);
        }
        else
        {
          \System::log('Initialization of system setting for DMS failed, because default base directory does not exists.', __METHOD__, TL_ERROR);
          return;
        }
      }
      
      if ($uuid != null)
      {
        \Config::persist(self::DMS_BASE_DIRECTORY_KEY, $uuid);
      }
    }
    
    if (!\Config::get(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY))
    {
      \System::log('Setting default DMS max. upload file size to "5 MB".', __METHOD__, TL_CONFIGURATION);
      \Config::persist(self::DMS_MAX_UPLOAD_FILE_SIZE_KEY, serialize(self::DMS_MAX_UPLOAD_FILE_SIZE_VALUE));
    }
  }
private function initSystemSettings ( ) { if ( \ Config :: get ( self :: DMS_BASE_DIRECTORY_KEY ) && \ Config :: get ( self :: DMS_MAX_UPLOAD_FILE_SIZE_KEY ) ) { return ; } \ System :: log ( 'Running init script for setting default DMS settings, if missing.' , __METHOD__ , TL_CONFIGURATION ) ; if ( ! \ Config :: get ( self :: DMS_BASE_DIRECTORY_KEY ) ) { \ System :: log ( 'Setting default DMS base directory to "' . $ this -> getDmsBaseDirectory ( ) . '".' , __METHOD__ , TL_CONFIGURATION ) ; $ uuid = null ; $ objDatabase = \ Database :: getInstance ( ) ; $ objDir = $ objDatabase -> prepare ( "SELECT * FROM tl_files WHERE path=?" ) -> limit ( 1 ) -> execute ( $ this -> getDmsBaseDirectory ( ) ) ; if ( $ objDir -> next ( ) ) { $ uuid = \ StringUtil :: binToUuid ( $ objDir -> uuid ) ; } if ( $ uuid == null ) { if ( file_exists ( TL_ROOT . '/' . $ this -> getDmsBaseDirectory ( ) ) ) { $ objDir = \ Dbafs :: addResource ( $ this -> getDmsBaseDirectory ( ) ) ; $ uuid = \ StringUtil :: binToUuid ( $ objDir -> uuid ) ; } else { \ System :: log ( 'Initialization of system setting for DMS failed, because default base directory does not exists.' , __METHOD__ , TL_ERROR ) ; return ; } } if ( $ uuid != null ) { \ Config :: persist ( self :: DMS_BASE_DIRECTORY_KEY , $ uuid ) ; } } if ( ! \ Config :: get ( self :: DMS_MAX_UPLOAD_FILE_SIZE_KEY ) ) { \ System :: log ( 'Setting default DMS max. upload file size to "5 MB".' , __METHOD__ , TL_CONFIGURATION ) ; \ Config :: persist ( self :: DMS_MAX_UPLOAD_FILE_SIZE_KEY , serialize ( self :: DMS_MAX_UPLOAD_FILE_SIZE_VALUE ) ) ; } }
Init the system setting
Set base directoy, if not set
Init the system setting Set base directoy if not set