Elgg\Application::getDataPath PHP Method

getDataPath() public static method

Determine the Elgg data directory with trailing slash, save it to config, and return it
public static getDataPath ( ) : string
return string
    public static function getDataPath()
    {
        $app = self::create();
        $app->services->config->loadSettingsFile();
        if ($GLOBALS['_ELGG']->dataroot_in_settings) {
            return $app->services->config->getVolatile('dataroot');
        }
        $dataroot = $app->services->configTable->get('dataroot');
        if (!$dataroot) {
            throw new \InstallationException('The config table lacks a value for "dataroot".');
        }
        $dataroot = rtrim($dataroot, '/\\') . DIRECTORY_SEPARATOR;
        $app->services->config->set('dataroot', $dataroot);
        return $dataroot;
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getDataPath()
 {
     if (!isset($this->config->dataroot)) {
         \Elgg\Application::getDataPath();
     }
     return $this->config->dataroot;
 }
All Usage Examples Of Elgg\Application::getDataPath