Initialize log storage

@param \common_persistence_Persistence $persistence
@return \common_report_Report
163697
public static function install($persistence)
    {
        $schemaManager = $persistence->getDriver()->getSchemaManager();
        $schema = $schemaManager->createSchema();
        $fromSchema = clone $schema;

        try {
            $table = $schema->createTable(self::TABLE_NAME);
            $table->addOption('engine', 'InnoDB');
            $table->addColumn(static::COLUMN_USER_ID, "string", ["length" => 255]);
            $table->addColumn(static::COLUMN_USER_ROLES, "string", ["notnull" => true, "length" => 4096]);
            $table->addColumn(static::COLUMN_ACTION, "string", ["notnull" => false, "length" => 4096]);
            $table->addColumn(static::COLUMN_EVENT_TIME, 'decimal', ['precision' => 14, 'scale'=>4, "notnull" => true]);
            $table->addColumn(static::COLUMN_DETAILS, "text", ["notnull" => false]);
            $table->addIndex([static::COLUMN_USER_ID], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_USER_ID);
            $table->addIndex([static::COLUMN_EVENT_TIME], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_EVENT_TIME);
        } catch(SchemaException $e) {
            \common_Logger::i('Database Schema already up to date.');
        }

        $queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema);
        foreach ($queries as $query) {
            $persistence->exec($query);
        }

        return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('User activity log successfully registered.'));
    }
593697
public function create($persisted = true)
    {
        return Phactory::createBlueprint($this->name, $this->type, $this->override, $persisted);
    }
274902
public function getLoggerEntityStorage() {
    // TODO: Delete this, after deprecated 'logger_entity' deleting
    // and create instance in __construct.
    if ($this->loggerEntityStorage) {
      return $this->loggerEntityStorage;
    }

    $this->loggerEntityStorage = $this->entityTypeManager
      ->getStorage($this->getLoggerEntityTypeName());
    return $this->loggerEntityStorage;
  }
298359
protected function createPersistence()
    {
        $session = $this->createSession();

        $cookie = $this->createCookie();

        $model = $this->config['persistences']['model'];

        $single = $this->config['persistences']['single'];

        return new IlluminatePersistenceRepository($session, $cookie, $model, $single);
    }
200324
public function atomic($f, Persistence $persistence = null)
    {
        if (!$persistence) {
            $persistence = $this->persistence;
        }

        return $persistence->atomic($f);
    }
344566
public function persister(PersisterInterface $persister = null)
    {
        if ($persister === null && $this->persister === null) {
            $persister = new ElasticSearchPersister();
        }

        if ($persister === null) {
            return $this->persister;
        }

        return $this->persister = $persister;
    }
660965
public function setSessionStorage(SessionInterface $storage)
    {
        $storage->setServer($this);
        $this->sessionStorage = $storage;

        return $this;
    }
510658
public function initQuery($m)
    {
        $d = $m->persistence_data['dsql'] = $this->dsql();

        if ($m->table) {
            if (isset($m->table_alias)) {
                $d->table($m->table, $m->table_alias);
            } else {
                $d->table($m->table);
            }
        }

        return $d;
    }
389720
protected function registerPersistences()
    {
        $this->registerSession();
        $this->registerCookie();

        $this->app->singleton( 'sentinel.persistence', function ( $app )
        {
            return new IlluminatePersistenceRepository(
                $app['sentinel.session'],
                $app['sentinel.cookie'],
                Persistence::class
            );
        } );
    }
257510
public function get($key)
    {
        $this->log(__FUNCTION__, $key);
        return $this->persistence->get($key);
    }
52243
private function initializeDoctrine()
    {
        if ($this->cm !== null) {
            return;
        }

        if (! self::$entityManager) {
            throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().');
        }

        $this->cm = self::$entityManager->getClassMetadata(static::class);
    }
152749
public function initializeEntity($entity, AutoTablesConfiguration $config) {
        $entityDescriptor = $this->fetchEntityDescriptor($config);
        foreach ($entityDescriptor->getColumnDescriptors() as $column) {
            if ($column->getInitializer()) {
                $value = null;
                if ($column->getInitializer()->getValue()) {
                    $value = $column->getInitializer()->getValue();
                } else if ($column->getInitializer()->getRepository()) {
                    $id = $column->getInitializer()->getId();
                    if (!$id) {
                        // search the id in the request
                        $request = $this->requestStack->getCurrentRequest();
                        if ($request) {
                            $id = $request->get('id'.$column->getId());
                        }
                    }
                    Ensure::isNotNull($id, 'Missing id for column [%s] in [%s]', $column->getName(), $config->getId());
                    $repository = $this->doctrine->getRepository($column->getInitializer()->getRepository());
                    Ensure::isNotNull($repository, 'Repository with id [%s] not found for [%s]', $column->getInitializer()->getRepository(), $config->getId());
                    $value = $repository->find($id);
                }
                $this->setValue($entity, $column->getId(), $value, $config);
            }
        }
    }
939080
public function getPersistence()
    {
        $persistenceOption = $this->getOption(self::DIAGNOSTIC_PERSISTENCE);
        $persistence = (!empty($persistenceOption)) ? $persistenceOption : 'default';
        return \common_persistence_Manager::getPersistence($persistence);
    }
849571
public function initialize()
    {
        if ( ! isset($this->authenticator)) {
            throw new \RuntimeException('Aegis is missing an authentication authenticator.');
        }

        if ( ! isset($this->storage)) {
            throw new \RuntimeException('Aegis is missing a persistent storage engine.');
        }

        // Set inital token to be anonymous until proven otherwise
        $this->setToken(new AnonymousToken());

        // Attempt to read token from persistent storage
        $token = $this->storage->read();

        // Re-authenticate stored token
        if ($token instanceof TokenInterface) {
            $result = $this->authenticate($token);
        }

        $this->initialized = true;

        return $this;
    }
907547
public function initialize()
    {
        $initializationQuery = 'INSERT INTO tx_solr_indexqueue_item (root, item_type, item_uid, indexing_configuration, indexing_priority, changed, errors) '
            . $this->buildSelectStatement() . ',"" '
            . 'FROM ' . $this->type . ' '
            . 'WHERE '
            . $this->buildPagesClause()
            . $this->buildTcaWhereClause()
            . $this->buildUserWhereClause();
        $logData = ['query' => $initializationQuery];

        try {
            $logData['rows'] = $this->queueItemRepository->initializeByNativeSQLStatement($initializationQuery);
        } catch (DBALException $DBALException) {
            $logData['error'] = $DBALException->getCode() . ': ' . $DBALException->getMessage();
        }

        $this->logInitialization($logData);
        return true;
    }
640750
protected function getCurrentKvResultStorage()
    {
        /** @var ResultServerService $resultService */
        $resultService = $this->getServiceLocator()->get(ResultServerService::SERVICE_ID);
        $resultStorageKey = $resultService->getOption(ResultServerService::OPTION_RESULT_STORAGE);
        if ($resultStorageKey != 'taoAltResultStorage/KeyValueResultStorage') {
            throw new \common_Exception('Result storage is not on KeyValue storage mode.');
        }
        return $resultService->instantiateResultStorage($resultStorageKey);
    }
675870
protected function initialize()
    {
        if (is_array($this->objectIdentifiers)) {
            foreach ($this->objectIdentifiers as $identifier) {
                try {
                    parent::attach($this->persistenceManager->getObjectByIdentifier($identifier));
                } catch (Exception\InvalidObjectDataException $exception) {
                    // when security query rewriting holds back an object here, we skip it...
                }
            }
            $this->objectIdentifiers = null;
        }
    }