Init mark(identifier) for sections

@param bool $forceUpdate
@return int
161854
public function initMark($forceUpdate)
    {
        if ($forceUpdate) {
            $this->markId = time();
            return $this->markId;
        }

        $cookieMarkId = false;
        if (!$this->markId) {
            $cookieMarkId = $this->cookieManager->getCookie(self::COOKIE_KEY);
        }

        $this->markId = $cookieMarkId ? $cookieMarkId : time();

        return $this->markId;
    }
929411
public function start($identifier = null, $force = false)
    {
        if ($this->currentImport instanceof Import) {
            throw new Exception('Unable to start a new import, please stop the current import first', 1426638560);
        }

        if ($identifier !== null) {
            $existingImport = $this->importRepository->findOneByExternalImportIdentifier($identifier);
            if (!$force  && $existingImport instanceof Import) {
                throw new ImportAlreadyExecutedException(sprintf('An import referring to the external identifier "%s" has already been executed on %s.', $identifier, $existingImport->getStartTime()->format('d.m.Y h:m:s')), 1464028408403);
            }
        }

        $this->currentImport = new Import();
        $this->currentImport->setExternalImportIdentifier($identifier);

        if ($force && isset($existingImport)) {
            $this->addEventMessage(sprintf('ImportService:start', 'Forcing re-import of data set with external identifier "%s".', $identifier), LOG_NOTICE);
        }

        $this->importRepository->add($this->currentImport);
        $this->persistenceManager->persistAll();
    }
1241255
public function ensurePropertiesIds($force = false)
    {
        if ($this->propertiesIds === null || $force === true) {
            $this->ensurePropertyGroupIds();
            $this->propertiesIds = [];

            foreach ($this->propertyGroupIds as $propertyGroupId) {
                $propertyIds = PropertyGroup::propertyIdsForGroup($propertyGroupId);
                foreach ($propertyIds as $propertyId) {
                    $this->propertiesIds[] = $propertyId;
                }
            }
            $this->propertiesIds = array_unique($this->propertiesIds);
        }
    }
759217
public function update(bool $force, OutputInterface $output)
    {
        $newSchema = new Schema();
        $this->schemaDefinition->define($newSchema);
        $currentSchema = $this->db->getSchemaManager()->createSchema();

        $migrationQueries = $currentSchema->getMigrateToSql($newSchema, $this->db->getDatabasePlatform());

        $this->db->transactional(function () use ($migrationQueries, $force, $output) {
            foreach ($migrationQueries as $query) {
                $output->writeln(sprintf('Running <info>%s</info>', $query));
                if ($force) {
                    $this->db->exec($query);
                }
            }
            if (empty($migrationQueries)) {
                $output->writeln('<info>The database is up to date</info>');
            }
        });

        if (!$force) {
            $output->writeln('<comment>No query was run, use the --force option to run the queries</comment>');
        } else {
            $output->writeln('<comment>Queries were successfully run against the database</comment>');
        }
    }
310402
public function getTablesInstalled($forceReload = true)
    {
        if (is_null($this->tablesInstalled)
            || $forceReload === true
        ) {
            $db = $this->getDb();
            $prefixTables = $this->getTablePrefixEscaped();

            $allTables = $this->getAllExistingTables($prefixTables);

            // all the tables to be installed
            $allMyTables = $this->getTablesNames();

            // we get the intersection between all the tables in the DB and the tables to be installed
            $tablesInstalled = array_intersect($allMyTables, $allTables);

            // at this point we have the static list of core tables, but let's add the monthly archive tables
            $allArchiveNumeric = $db->fetchCol("SHOW TABLES LIKE '" . $prefixTables . "archive_numeric%'");
            $allArchiveBlob    = $db->fetchCol("SHOW TABLES LIKE '" . $prefixTables . "archive_blob%'");

            $allTablesReallyInstalled = array_merge($tablesInstalled, $allArchiveNumeric, $allArchiveBlob);

            $this->tablesInstalled = $allTablesReallyInstalled;
        }

        return $this->tablesInstalled;
    }
1015671
public function insert(DataAbstract $data, $forceUpdate = false)
    {
        if ($data->exists() && !$data->isUpdated()) {
            return false;
        }

        //~ Reset binded fields
        $this->binds = array();

        $querySet = $this->getQueryFieldsSet($data, false);
        if (empty($querySet)) {
            throw new \LogicException(__METHOD__ . '|Set clause cannot be empty !');
        } else {
            $querySet = ' ' . $querySet;
        }

        $queryDuplicateUpdate = '';

        if ($forceUpdate || $data->exists()) {
            $queryDuplicateUpdate = $this->getQueryFieldsOnDuplicateUpdate($data);

            if (empty($queryDuplicateUpdate)) {
                throw new \LogicException(__METHOD__ . '|ON DUPLICATE UPDATE clause cannot be empty !');
            }

            $queryDuplicateUpdate = ' ' . $queryDuplicateUpdate;
        }

        $query     = 'INSERT INTO ' . $this->getTable() . $querySet . $queryDuplicateUpdate;
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        //~ If has auto increment key (generaly, is a primary key), set value
        $lastInsertId = (int) $this->db->lastInsertId();
        if ($lastInsertId > 0) {
            $this->lastId = $lastInsertId;

            $data->setAutoIncrementId($this->getLastId());
        }

        //~ Reset some data
        $data->setExists(true);
        $data->resetUpdated();

        //~ Clear
        $this->clear();
        $this->deleteCache($data);

        return true;
    }
348058
public function getToken($forceNew = false)
    {
        /** @var Session $session */
        $session = $this->session;

        $token = $session->get(static::TOKEN_KEY);

        // Create a token
        if ($token === null || $forceNew) {
            $token = $this->createToken(12);

            $session->set(static::TOKEN_KEY, $token);
        }

        return $token;
    }
996434
private function indexCode($force = false) {
        if (!$this->index_code || $force) {
            foreach ($this->index as $word => $code) {
                $this->index_code[$code] = $word;
            }
        }
    }
30808
function init($idBuilder="0", $tabOnglets=array())
    {
        $this->ongletsArray=$tabOnglets;
        $this->typeOngletsArray=array();
        $this->optionsOngletParType = array();
        $this->idOngletBuilder=$idBuilder;
        $this->largeurTotale=680;
        $this->largeurEtiquette=150;
        $this->numOngletSelected=0;
        $this->champHiddenCourant="";
        $this->isContours = true;
        $this->isAncreOnglet = true;
        $this->isSpaceInLibelle = true;
        $this->styleContenu = "";
    }
941289
public function beforeUpdate()
    {
        foreach ($this->models as $relationName => $config) {
            $this->markFilesAsPermanent($this->getRelationValues($relationName));
        }
    }
149385
public function getToken($forceRefresh = false)
    {
        $cacheKey = [__CLASS__, 'appId' => Yii::$app->wechat->appId];
        if ($forceRefresh || ($accessToken = Yii::$app->wechat->cache->get($cacheKey)) === false) {
            $token = $this->getTokenFromServer();
            Yii::$app->wechat->cache->set($cacheKey, $token[$this->tokenJsonKey], $token['expires_in'] - 1500);
            return $token[$this->tokenJsonKey];
        }
        return $accessToken;
    }
164837
private function indent($force = false)
    {
        if ($this->size || $force) {
            $this->result .= $this->break;
        }

        if ($this->size) {
            $this->result .= str_repeat(
                $this->char,
                $this->size * $this->level
            );
        }
    }
426611
public function getRememberSession($forceStart = FALSE)
    {
        $presenter = $this->getPresenter();
        $session = $presenter->getSession();

        if (!$session->isStarted() && $forceStart) {
            $session->start();
        }

        return $session->isStarted()
            ? ($session->getSection($this->rememberStateSectionName ?: ($presenter->name . ':' . $this->getUniqueId())))
            : NULL;
    }
705183
public function getSqlActiveSnippet($forceCoreTable = null)
    {
        $query = '';
        $tableName = $this->getViewName($forceCoreTable);

        // has 'active' field ?
        if (isset($this->_aFieldNames['oxactive'])) {
            $query = " $tableName.oxactive = 1 ";
        }

        // has 'activefrom'/'activeto' fields ?
        if (isset($this->_aFieldNames['oxactivefrom']) && isset($this->_aFieldNames['oxactiveto'])) {
            $query = $this->addSqlActiveRangeSnippet($query, $tableName);
        }

        return $query;
    }
1159245
public function getUpdatedAt() : ?int 
    {
        if ( ! $this->hasUpdatedAt()) {
            $this->setUpdatedAt($this->getDefaultUpdatedAt());
        }
        return $this->updatedAt;
    }
491789
function updateFromParent( $forceUpdate = false )
    {
        $mainNode = eZContentObjectTreeNode::findMainNode( $this->attribute( 'contentobject_id' ), true );
        if ( !is_object( $mainNode ) )
        {
            eZDebug::writeDebug( 'mainNode not found', 'eZPaEx::updateFromParent' );
        }
        elseif ( $mainNode->attribute( 'depth' ) > 1 )
        {
            $parentMainNodeID = $mainNode->attribute('parent_node_id');
            $parentContentObject = eZContentObject::fetchByNodeID( $parentMainNodeID );
            $parentPaex = eZPaEx::getPaEx($parentContentObject->attribute('id'));
            if ( $parentPaex instanceof eZPaEx )
            {
                $paexUpdated = false;

                if ( !$this->hasRegexp() || $forceUpdate )
                {
                    $this->setAttribute( 'passwordvalidationregexp', $parentPaex->attribute( 'passwordvalidationregexp' ) );
                    $paexUpdated = true;
                }

                if ( !$this->hasLifeTime() || $forceUpdate )
                {
                    $this->setAttribute( 'passwordlifetime', $parentPaex->attribute( 'passwordlifetime' ) );
                    $paexUpdated = true;
                }

                if ( !$this->hasNotification() || $forceUpdate )
                {
                    $this->setAttribute( 'expirationnotification', $parentPaex->attribute( 'expirationnotification' ) );
                    $paexUpdated = true;
                }

                if ( $paexUpdated )
                {
                    eZDebug::writeDebug( 'Paex updated from parent', 'eZPaEx::updateFromParent' );
                    $this->store();
                }
            }
        }

        return true;
    }
818243
public function process($forceOrder = false)
    {
         // sort the replacements by descending
         // (in that way some problems with replacements naming can be avoided)
        if (!$forceOrder) {
            array_multisort(
                array_map('mb_strlen', array_keys($this->replacements)),
                SORT_DESC,
                $this->replacements
            );
        }

        // decide which function will be used
        $replaceFunc = $this->isDelimitersUsed() ? 'replaceWithRegexp' : 'replaceBasic';

        foreach ($this->replacements as $searchFor => $replaceWith) {
            $this->$replaceFunc($searchFor, $replaceWith);
        }

        // for chaining
        return $this;
    }