Init the umask to use creating files/directories, either with
the passed value or the one found in the configuration.

@param integer $umask The new umask to set

@return void
@throws \Exception Is thrown if the umask can not be set
351232
public function initUmask($umask = null)
    {

        // check if a umask has been passed
        if ($umask == null) {
            $umask = $this->getInitialContext()->getSystemConfiguration()->getParam('umask');
        }

        // initialize the umask
        FileSystem::initUmask($umask);
    }
1327847
public function init()
    {
        if (count($this->buckets))
        {
            foreach ($this->buckets as $alias => $bucket) 
            {
                $this->_buckets[$alias] = new BucketFileSystem(
                    $bucket['basePath'],
                    $bucket['baseUrl'],
                    isset($bucket['filePermission']) ? $bucket['filePermission'] : 0777
                );
            }
        }
    }
647801
public function initialize()
    {
        $app = $this->app;

        $include = $app->request->get('!include');
        if (!empty($include)) {
            Norm::options('include', true);
        }

        $tz = $app->request->get('!tz');
        if (!empty($tz)) {
            Norm::options('tz', $tz);
        }

        if (!isset($this->options['datasources'])) {
            $this->options['datasources'] = $this->app->config('norm.datasources');
        }

        // DEPRECATED: norm.databases deprecated
        if (!isset($this->options['datasources'])) {
            $this->options['datasources'] = $this->app->config('norm.databases');
        }

        if (!isset($this->options['datasources'])) {
            throw new \Exception('[Norm] No data source configuration. Append "norm.datasources" bono configuration!');
        }

        if (!isset($this->options['collections'])) {
            $this->options['collections'] = $this->app->config('norm.collections');
        }

        Norm::init($this->options['datasources'], $this->options['collections']);

        $controllerConfig = $this->app->config('bono.controllers');
        if (!isset($controllerConfig['default'])) {
            $controllerConfig['default'] = 'Norm\\Controller\\NormController';
        }
        $this->app->config('bono.controllers', $controllerConfig);

        if (! class_exists('Norm')) {
            class_alias('Norm\\Norm', 'Norm');
        }

        $d = explode(DIRECTORY_SEPARATOR.'src', __DIR__);
        $this->app->theme->addBaseDirectory($d[0], 10);
    }
1309864
public function init()
    {
        // Initializes the file service.
        $this->createClass('Brainworxx\\Krexx\\Service\\Misc\\File');
        // Initializes the messages.
        $this->createClass('Brainworxx\\Krexx\\View\\Messages');
        // Initialize the encoding service.
        $this->createClass('Brainworxx\\Krexx\\Service\\Misc\\Encoding');
        // Initializes the configuration.
        $this->createClass('Brainworxx\\Krexx\\Service\\Config\\Config');
        // Initialize the emergency handler.
        $this->createClass('Brainworxx\\Krexx\\Service\\Flow\\Emergency');
        // Initialize the recursionHandler.
        $this->createClass('Brainworxx\\Krexx\\Service\\Flow\\Recursion');
        // Initialize the code generation.
        $this->createClass('Brainworxx\\Krexx\\Analyse\\Code\\Codegen');
        // Initializes the chunks handler.
        $this->createClass('Brainworxx\\Krexx\\View\\Output\\Chunks');
        // Initializes the scope analysis.
        $this->createClass('Brainworxx\\Krexx\\Analyse\\Code\\Scope');
        // Initializes the routing.
        $this->createClass('Brainworxx\\Krexx\\Analyse\Routing\\Routing');
        // Initialize the event handler.
        $this->createClass('Brainworxx\\Krexx\\Service\\Factory\\Event');
        // Initializes the render class.
        $this->createClass($this->config->getSkinClass());
        // Check the environment and prepare the feedback, if necessary.
        $this->checkEnvironment();
    }
451859
public function init()
    {
        if(is_null($this->cronGroup)){
            $this->cronGroup = Inflector::slug( Yii::$app->id .'-'. Yii::getAlias('@app'));
        } else {
            $this->cronGroup = Inflector::slug( $this->cronGroup );
        }
        $this->setComponents([
            $this->nameComponent => [
                'class'      => 'gofmanaa\crontask\components\Crontab',
                'filename'   => $this->fileName,
                'directory'  => $this->fileDir,
                'crontabPath'=> $this->crontabPath,
                'cronGroup'  => $this->cronGroup
            ],
        ]);

        parent::init();


    }
681703
public function init()
	{
		parent::init();
		if($this->authFile===null)
			$this->authFile=Yii::getPathOfAlias('application.data.auth').'.php';
		$this->load();
	}
680127
public function initialize()
    {
        if (is_null($value = $this->getValue())) {
            $value = request()->input($this->getAlias());
        }

        $this->setValue($value);
    }
1255262
public function init()
    {
        $containerPath = __DIR__ . '/../../../../../www/cache';
        $containerName = 'ContainerCore';
        $containerNamespace = 'samsonphp\core\loader';
        /** @var Module $module */
        $modules = $this->moduleManager->getRegisteredModules();

        $localModulesPath = '../src';
        ResourceMap::get('cache');
        $resourceMap = ResourceMap::get($localModulesPath);
        $localModules = $resourceMap->modules;

        if (false || !file_exists($containerPath . '/' . $containerName . '.php')) {

            $builder = new DefinitionBuilder(new ParameterBuilder());
            $xmlResolver = new XmlResolver();
            $xmlResolver->resolveFile($builder, __DIR__ . '/../../../../../app/config/config.xml');

            new Service('');
            new InjectService('');
            new InjectClass('');
            new InjectParameter('');

            foreach ($modules as $module) {
                if ($module->className && !$builder->hasDefinition($module->className)) {
                    // Fix samson.php files
                    if (!class_exists($module->className)) {
                        require_once($module->pathName);
                    }
                    /** @var ClassDefinition $classDefinition */
                    $classDefinition = $builder->addDefinition($module->className);
                    if ($id = $this->getModuleId($module->pathName)) {
                        $classDefinition->setServiceName($id);
                    } else {
                        // Generate identifier from module class
                        $classDefinition->setServiceName(
                            strtolower(ltrim(str_replace(__NS_SEPARATOR__, '_', $module->className), '_'))
                        );
                    }
                    $classDefinition->addScope(new ModuleScope())->setIsSingleton(true);
                    $this->defineConstructor($classDefinition, $module->path);
                }
            }

            $classDefinition = $builder->addDefinition(VirtualModule::class);
            $classDefinition->addScope(new ModuleScope())->setServiceName('local')->setIsSingleton(true);
            $this->defineConstructor($classDefinition, getcwd());

            foreach ($localModules as $moduleFile) {
                if (!$builder->hasDefinition($moduleFile[0])) {

                    /** @var ClassDefinition $classDefinition */
                    $classDefinition = $builder->addDefinition($moduleFile[0]);
                    $classDefinition->addScope(new ModuleScope());
                    $classDefinition->setIsSingleton(true);
                    if ($id = $this->getModuleId($moduleFile[1])) {
                        $classDefinition->setServiceName($id);
                    } else {
                        throw new \Exception('Can not get id of local module');
                    }

                    $modulePath = explode('/', str_replace(realpath($localModulesPath), '', $moduleFile[1]));
                    $this->defineConstructor($classDefinition, $localModulesPath . '/' . $modulePath[1]);
                }
            }


            /**
             * Add implementors
             */
            foreach ($this->moduleManager->implements as $interfaceName => $class) {
                $builder->defineImplementors($interfaceName, new ClassReference($class));
            }

            // Init compiler
            $reader = new AnnotationReader();
            $compiler = new DefinitionCompiler(
                new DefinitionGenerator(new ClassGenerator()),
                (new DefinitionAnalyzer())
                    ->addClassAnalyzer(new AnnotationClassAnalyzer($reader))
                    ->addClassAnalyzer(new ReflectionClassAnalyzer())
                    ->addMethodAnalyzer(new AnnotationMethodAnalyzer($reader))
                    ->addMethodAnalyzer(new ReflectionMethodAnalyzer())
                    ->addPropertyAnalyzer(new AnnotationPropertyAnalyzer($reader))
                    ->addPropertyAnalyzer(new ReflectionPropertyAnalyzer())
                    ->addParameterAnalyzer(new ReflectionParameterAnalyzer())
            );

            $container = $compiler->compile($builder, $containerName, $containerNamespace, $containerPath);

        } else {

            $containerClassName = $containerNamespace. '\\' . $containerName;
            require_once($containerPath . '/' . $containerName . '.php');
            $container = new $containerClassName();
        }

        $GLOBALS['__core'] = $container->get('core');

        $this->prepareModules($modules, $container);

        /** @var array $module */
        foreach ($localModules as $module) {
            $instance = $container->get($module[0]);
            $instance->parent = $this->getClassParentModule($container, get_parent_class($instance));
        }

//        $container->get('core')->active($container->get('local'));

        return $container;
    }
1284188
public function init()
    {
        if ($this->isConfigConsistent()) {
            $this->setSaml(new Saml(
                Metadata::load(
                    $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getIdpMetadataFile(),
                    $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getSpMetadataFile()
                ),
                $this->getConfig()->getPrivateKey()
            ));
        } else {
            $metadata = new Metadata();
            $metadata->setIdentityProvider(
                $metadata->createEntityDescriptor(
                    file_get_contents(
                        $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getIdpMetadataFile()
                    )
                )
            );

            $this->setSaml(new Saml($metadata, $this->getConfig()->getPrivateKey()));
        }
    }
1219689
public function init()
    {
        // Check filepath
        if (empty($this->filepath)) {
            return;
        }

        // Get configurations
        $settings = include $this->filepath;

        // Check
        if (empty($settings)) {
            return;
        }

        // Update
        $this->configs = $settings;

        // Enable backend~frontend actions
        if (OL_ZEUS_ISADMIN) {
            // Backend
            add_action('init', [$this, 'addShortcodesBackend']);
        } else {
            // Frontend
            add_action('init', [$this, 'addShortcodesFrontend']);
        }
    }
901095
final public function initialize()
    {
        $this->_ensureModuleExistence();
        $this->memcache = new Memcache();
        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(";", $this->host);
        // different ports for each hosts the same way
        $ports = explode(";", $this->port);
        if (count($hosts) > 1) {
            if (count($ports) < 1) {
                $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
            } elseif (count($ports) == 1) {
                // if we have just one port, use it for all hosts
                $_p = $ports[0];
                $ports = array_fill(0, count($hosts), $_p);
            }
            foreach ($hosts as $i => $host) {
                $this->memcache->addServer($host, $ports[$i]);
            }
        } else {
            // just connect to the single host
            $this->memcache->connect($hosts[0], $ports[0]);
        }
    }
1285073
public function init($request)
    {
        if ($file = $request->getUploadedFile('importSql')) {
            $databaseHandler = $this->getDatabaseHandler();
            $databaseHandler->import($file);
        }

        if ($request->getParameter('dumpDB')) {
            $databaseRestorer = $this->getDatabaseRestorer();
            $databaseRestorer->dumpDB($request->getParameter('dump-prefix'));
        }

        if ($request->getParameter('restoreDB')) {
            $databaseRestorer = $this->getDatabaseRestorer();
            $databaseRestorer->restoreDB($request->getParameter('dump-prefix'));
        }
    }
768895
public function init() {
        if (preg_match('/^[0-9]+;/', $this->sessiondir)) {
            throw new exception('sessionhandlerproblem', 'error', '', null, 'Multilevel session directories are not supported');
        }
        // Make sure session directory exists and is writable.
        make_writable_directory($this->sessiondir, false);
        if (!is_writable($this->sessiondir)) {
            throw new exception('sessionhandlerproblem', 'error', '', null, 'Session directory is not writable');
        }
        // Need to disable debugging since disk_free_space()
        // will fail on very large partitions (see MDL-19222).
        $freespace = @disk_free_space($this->sessiondir);
        // MDL-43039: disk_free_space() returns null if disabled.
        if (!($freespace > 2048) and ($freespace !== false) and ($freespace !== null)) {
            throw new exception('sessiondiskfull', 'error');
        }

        // NOTE: we cannot set any lock acquiring timeout here - bad luck.
        ini_set('session.save_handler', 'files');
        ini_set('session.save_path', $this->sessiondir);
    }
541328
public function init()
    {
        if ($this->initialized) {
            return;
        }

        self::setRequestIdHeader();

        $this->initialized = true;

        $tmpPath = StaticContainer::get('path.tmp');

        $directoriesToCheck = array(
            $tmpPath,
            $tmpPath . '/assets/',
            $tmpPath . '/cache/',
            $tmpPath . '/logs/',
            $tmpPath . '/tcpdf/',
            $tmpPath . '/templates_c/',
        );

        Filechecks::dieIfDirectoriesNotWritable($directoriesToCheck);

        $this->handleMaintenanceMode();
        $this->handleProfiler();
        $this->handleSSLRedirection();

        Plugin\Manager::getInstance()->loadPluginTranslations();
        Plugin\Manager::getInstance()->loadActivatedPlugins();

        // try to connect to the database
        try {
            Db::createDatabaseObject();
            Db::fetchAll("SELECT DATABASE()");
        } catch (Exception $exception) {
            if (self::shouldRethrowException()) {
                throw $exception;
            }

            Log::debug($exception);

            /**
             * Triggered when Piwik cannot connect to the database.
             *
             * This event can be used to start the installation process or to display a custom error
             * message.
             *
             * @param Exception $exception The exception thrown from creating and testing the database
             *                             connection.
             */
            Piwik::postEvent('Db.cannotConnectToDb', array($exception), $pending = true);

            throw $exception;
        }

        // try to get an option (to check if data can be queried)
        try {
            Option::get('TestingIfDatabaseConnectionWorked');
        } catch (Exception $exception) {
            if (self::shouldRethrowException()) {
                throw $exception;
            }

            Log::debug($exception);

            /**
             * Triggered when Piwik cannot access database data.
             *
             * This event can be used to start the installation process or to display a custom error
             * message.
             *
             * @param Exception $exception The exception thrown from trying to get an option value.
             */
            Piwik::postEvent('Config.badConfigurationFile', array($exception), $pending = true);

            throw $exception;
        }

        // Init the Access object, so that eg. core/Updates/* can enforce Super User and use some APIs
        Access::getInstance();

        /**
         * Triggered just after the platform is initialized and plugins are loaded.
         *
         * This event can be used to do early initialization.
         *
         * _Note: At this point the user is not authenticated yet._
         */
        Piwik::postEvent('Request.dispatchCoreAndPluginUpdatesScreen');

        $this->throwIfPiwikVersionIsOlderThanDBSchema();

        $module = Piwik::getModule();
        $action = Piwik::getAction();

        if (empty($module)
            || empty($action)
            || $module !== 'Installation'
            || !in_array($action, array('getInstallationCss', 'getInstallationJs'))) {
            \Piwik\Plugin\Manager::getInstance()->installLoadedPlugins();
        }

        // ensure the current Piwik URL is known for later use
        if (method_exists('Piwik\SettingsPiwik', 'getPiwikUrl')) {
            SettingsPiwik::getPiwikUrl();
        }

        $loggedIn = false;

        // try authenticating w/ session first...
        $sessionAuth = $this->makeSessionAuthenticator();
        if ($sessionAuth) {
            $loggedIn = Access::getInstance()->reloadAccess($sessionAuth);
        }

        // ... if session auth fails try normal auth (which will login the anonymous user)
        if (!$loggedIn) {
            $authAdapter = $this->makeAuthenticator();
            Access::getInstance()->reloadAccess($authAdapter);
        } else {
            $this->makeAuthenticator($sessionAuth); // Piwik\Auth must be set to the correct Login plugin
        }

        // Force the auth to use the token_auth if specified, so that embed dashboard
        // and all other non widgetized controller methods works fine
        if (Common::getRequestVar('token_auth', false, 'string') !== false) {
            Request::reloadAuthUsingTokenAuth();
        }
        SettingsServer::raiseMemoryLimitIfNecessary();

        \Piwik\Plugin\Manager::getInstance()->postLoadPlugins();

        /**
         * Triggered after the platform is initialized and after the user has been authenticated, but
         * before the platform has handled the request.
         *
         * Piwik uses this event to check for updates to Piwik.
         */
        Piwik::postEvent('Platform.initialized');
    }
898320
protected function init()
    {
        $this->bindContainerObjects();
        $this->metaFile = storage_path('cms/disabled.json');
        $this->loadDisabled();
        $this->loadPlugins();

        if ($this->app->runningInBackend()) {
            $this->loadDependencies();
        }
    }
953969
public function init()
    {
        $this->setIsDisableCapable(false)
             ->setIsDisableElementsCapable(false);

        $this->setForms(
            array(
            'contact' => array(
                'type' => 'Auth/UserInfo',
                'property' => true,
            ),
            'image' => array(
                'type' => 'Applications/ContactImage',
                'property' => true,
                'use_files_array' => true,
            ),
            )
        );
    }
146700
private static function init() {
        self::$appContext = new AppContext(self::$config);

        if (isset(self::$config['customHandlers'])) {
            if (is_callable(self::$config['customHandlers'])) {
                call_user_func(self::$config['customHandlers'], self::$appContext);
            }
            else {
                throw new \Exception('Function is expected.');
            }
        }

        self::invokeAll(self::$appContext->getPreInit(), array(self::$appContext));

        $config = self::$appContext->getConfig();

        if (empty($config['appNamespace'])) {
            throw new \Exception('The root namespace for the application is required. To specify the namespace of your application, use the useNamespace method. The value must not be null or empty.');
        }

        if (empty($config['basePath'])) {
            $config['basePath'] = getcwd();
        }

        if (!defined('PHPMVC_DS')) { define('PHPMVC_DS', DIRECTORY_SEPARATOR); }
        if (!defined('PHPMVC_ROOT_PATH')) { define('PHPMVC_ROOT_PATH', $config['basePath'] . PHPMVC_DS); }
        if (!defined('PHPMVC_CORE_PATH')) { define('PHPMVC_CORE_PATH', __DIR__ .PHPMVC_DS); }
        if (!defined('PHPMVC_CONFIG_PATH')) { define('PHPMVC_CONFIG_PATH', PHPMVC_ROOT_PATH . 'config' . PHPMVC_DS); }
        if (!defined('PHPMVC_FILTER_PATH')) { define('PHPMVC_FILTER_PATH', PHPMVC_ROOT_PATH . 'filters' . PHPMVC_DS); }
        if (!defined('PHPMVC_CONTROLLER_PATH')) { define('PHPMVC_CONTROLLER_PATH', PHPMVC_ROOT_PATH . 'controllers' . PHPMVC_DS); }
        if (!defined('PHPMVC_MODEL_PATH')) { define('PHPMVC_MODEL_PATH', PHPMVC_ROOT_PATH . 'models' . PHPMVC_DS); }
        if (!defined('PHPMVC_VIEW_PATH')) { define('PHPMVC_VIEW_PATH', PHPMVC_ROOT_PATH . 'views' . PHPMVC_DS); }
        if (!defined('PHPMVC_SHARED_PATH')) { define('PHPMVC_SHARED_PATH', PHPMVC_VIEW_PATH . 'shared' . PHPMVC_DS); }
        if (!defined('PHPMVC_UPLOAD_PATH')) { define('PHPMVC_UPLOAD_PATH', PHPMVC_ROOT_PATH . 'upload' . PHPMVC_DS); }

        if (!defined('PHPMVC_APP_NAMESPACE')) {
            define('PHPMVC_APP_NAMESPACE', $config['appNamespace']);
        }
        elseif (PHPMVC_APP_NAMESPACE !== $config['appNamespace']) {
            throw new \Exception('Constant PHPMVC_CONTROLLER already defined. Re-define with other value is not possible.');
        }

        if (empty($config['routeProvider'])) {
            $config['routeProvider'] = new DefaultRouteProvider();
        }
        elseif (!$config['routeProvider'] instanceof RouteProvider) {
            throw new \Exception('The routeProvider type must be the base of "\PhpMvc\RouteProvider".');
        }

        $config['routeProvider']->init();

        if (isset($config['routes'])) {
            if (is_callable($config['routes'])) {
                $config['routes']($config['routeProvider']);
            }
            elseif (is_array($config['routes'])) {
                $provider = $config['routeProvider'];

                foreach($config['routes'][0] as $route) {
                    $provider->add($route->name, $route->template, $route->defaults, $route->constraints);
                }

                if (count($config['routes']) > 1) {
                    foreach($config['routes'][1] as $route) {
                        $provider->ingnore($route->template, $route->constraints);
                    }
                }
            }
            elseif ($config['routes'] instanceof RouteCollection) {
                $provider = $config['routeProvider'];

                foreach($config['routes'] as $route) {
                    $provider->add($route->name, $route->template, $route->defaults, $route->constraints);
                }
            }
        }

        if (empty($config['cacheProvider'])) {
            $config['cacheProvider'] = new IdleCacheProvider();
        }
        elseif (!$config['cacheProvider'] instanceof CacheProvider) {
            throw new \Exception('The $cacheProvider type must be the base of "\PhpMvc\CacheProvider".');
        }

        $config['cacheProvider']->init();

        if (isset($config['sessionProvider'])) {
            if ($config['sessionProvider'] === true) {
                $config['sessionProvider'] = new HttpSession();
            }
            elseif (!$config['sessionProvider'] instanceof HttpSessionProvider) {
                throw new \Exception('The $sessionProvider type must be the base of "\PhpMvc\HttpSessionProvider".');
            }

            $config['sessionProvider']->init();
        }

        if (empty($config['httpContext'])) {
            $info = new HttpContextInfo();
            $info->routeProvider = $config['routeProvider'];
            $info->cacheProvider = $config['cacheProvider'];
            $info->request = new HttpRequest();
            $info->response = new HttpResponse();
            $info->session = isset($config['sessionProvider']) ? $config['sessionProvider'] : null;

            $config['httpContext'] = new HttpContext($info);
        }
        elseif (!$config['httpContext'] instanceof HttpContextBase) {
            throw new \Exception('The httpContext type must be the base of "\PhpMvc\HttpContextBase".');
        }

        // default response handlers
        $response = $config['httpContext']->getResponse();

        $response->setEndHandler(function() use ($config) {
            self::invokeAll(self::$appContext->getEnd(), array(new ActionContext($config['httpContext'])));
        });

        $response->setPreSendHandler(function() use ($config) {
            self::invokeAll(self::$appContext->getPreSend(), array(new ActionContext($config['httpContext'])));
        });

        // set context and config, and invoke init handlers
        InternalHelper::setStaticPropertyValue('\\PhpMvc\\HttpContext', 'current', $config['httpContext']);

        self::$appContext->setConfig($config);
        self::invokeAll(self::$appContext->getInit(), array(self::$appContext));
        self::$config = self::$appContext->getConfig();
    }