Get CTAs assigned to this Site Target instance.
@param bool $force If true, the CTA list is refreshed from the database.
@return CNabuSiteTargetCTAList Returns the list of CTAs. If none CTA exists, the list is empty.
351309
public function getCTAs($force = false)
    {
        if ($this->nb_site_target_cta_list->isEmpty() || $force) {
            $this->nb_site_target_cta_list->clear();
            $this->nb_site_target_cta_list->merge(CNabuSiteTargetCTA::getSiteTargetCTAs($this));
            $translations = CNabuSiteTargetCTALanguage::getCTATranslationsForSiteTarget($this);
            if (is_array($translations) && count($translations) > 0) {
                foreach ($translations as $translation) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($translation->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->setTranslation($translation);
                    }
                }
            }
            $roles = CNabuSiteTargetCTARole::getCTARolesForSiteTarget($this);
            if (is_array($roles) && count($roles) > 0) {
                foreach ($roles as $role) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($role->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->addRole($role);
                    }
                }
            }
        }

        return $this->nb_site_target_cta_list;
    }
991462
public function check($force = false)
    {
        /*
         * Already know about updates, never retry.
         */
        $oldCount = Parameter::get('system::update.count');
        if ($oldCount > 0) {
            return $oldCount;
        }

        /*
         * Retry period not passed, skipping.
         */
        if (!$force
            && ($retryTimestamp = Parameter::get('system::update.retry'))
            && Carbon::createFromTimeStamp($retryTimestamp)->isFuture()
        ) {
            return $oldCount;
        }

        try {
            $result = $this->requestUpdateList();
            $newCount = array_get($result, 'update', 0);
        }
        catch (Exception $ex) {
            $newCount = 0;
        }

        /*
         * Remember update count, set retry date
         */
        Parameter::set('system::update.count', $newCount);
        Parameter::set('system::update.retry', Carbon::now()->addHours(24)->timestamp);

        return $newCount;
    }
458641
public static function createAdminRole($force = false)
    {
        if(!$force) {
            if(Permission::exists('global', 'admin')) {
                return false;
            }
        }

        return self::createRole(
            'Admin', true, [[
            'app' => 'global',
            'key' => 'admin'
            ]]
        );
    }
96949
public function getPrescriber(bool $force = false)
    {
        if ($this->nb_prescriber == NULL ||
            $this->nb_prescriber->getId() != $this->getPrescriberId() ||
            $force
        ) {
            $nb_prescriber_id = $this->getPrescriberId();
            if ($nb_prescriber_id === null || $this->getCustomer() === null) {
                $this->nb_prescriber = null;
            } else {
                $this->nb_prescriber = $this->getCustomer()->getUser($nb_prescriber_id);
            }
        }

        return $this->nb_prescriber;
    }
666360
public function getCommerces($force = false)
    {
        if ($this->nb_commerce_list->isEmpty() || $force) {
            $this->nb_commerce_list->clear();
            $this->nb_commerce_list->merge(CNabuCommerce::getAllCommerces($this));
        }

        return $this->nb_commerce_list->getItems();
    }
1090281
public function hasCache($force = FALSE) {

		if(!isset($this->cacheFound) || $force) {
			$this->cacheFound = is_dir($this->path . self::CACHE_PATH);
		}

		return $this->cacheFound;

	}
390532
public function get_urls( $force = false ) {

		if( !$force && $this->urls !== null ) {
			return $this->urls;
		}

		$tArray = array(
			'action' => 'query',
			'prop'   => 'info',
			'inprop' => 'url',
			'titles' => $this->title,
		);

		pecho( "Getting the URLs for {$this->title}..\n\n", PECHO_NORMAL );

		$tRes = $this->wiki->apiQuery( $tArray );
		$info = $tRes['query']['pages'][$this->pageid];

		$this->urls = array();

		if( isset( $info['fullurl'] ) ) $this->urls['full'] = $info['fullurl'];
		if( isset( $info['editurl'] ) ) $this->urls['edit'] = $info['editurl'];

		return $this->urls;
	}
630973
function getAllRoles($force = false)
    {
        if ($force == false and ! is_null($this->_cache_perms)) {
            return $this->_cache_perms;
        }
        $this->_cache_perms = array();
        if ($this->isAnonymous()) {
            return $this->_cache_perms;
        }
        // load user permissions
        $this->_cache_perms = (array) $this->get_roles_list();

        // Load groups
        $groups = $this->get_groups_list();
        $ids = array();
        foreach ($groups as $group) {
            $ids[] = $group->id;
        }
        // load groups permisson
        if (count($ids) > 0) {
            $this->loadGroupRoles($ids);
        }
        return $this->_cache_perms;
    }
936120
public function provideFlatten($force = TRUE) {

     if ($this->isEmpty()) {
       $this->flattenjson = [];
     }
     else {
       if ($this->flattenjson == NULL || $force) {
         $mainproperty = $this->mainPropertyName();
         $jsonArray = json_decode($this->{$mainproperty}, TRUE, 10);
         $flattened = [];
         StrawberryfieldJsonHelper::arrayToFlatCommonkeys(
           $jsonArray,
           $flattened,
           TRUE
         );
         $this->flattenjson = $flattened;
       }
     }
     return $this->flattenjson;
   }
426585
public function persist($force = false) {
        global $DB;

        if (!$this->dirty && !$force) {
            return $this;
        }

        if ($this->id) {
            $record = $this->to_record();
            $DB->update_record('tool_usertours_tours', $record);
        } else {
            $this->calculate_sortorder();
            $record = $this->to_record();
            unset($record->id);
            $this->id = $DB->insert_record('tool_usertours_tours', $record);
        }

        $this->reload();

        // Notify the cache that a tour has changed.
        cache::notify_tour_change();

        return $this;
    }
660628
public function getIContactProspect($force = false)
    {
        if ($this->nb_icontact_prospect === null || $force) {
            $this->nb_icontact_prospect = null;
            if ($this instanceof CNabuDataObject &&
                !$this->isBuiltIn()
                && $this->isValueNumeric(NABU_ICONTACT_PROSPECT_FIELD_ID)
            ) {
                $nb_icontact_prospect = new CNabuIContactProspect($this->getValue(NABU_ICONTACT_PROSPECT_FIELD_ID));
                if ($nb_icontact_prospect->isFetched()) {
                    $this->nb_icontact_prospect = $nb_icontact_prospect;
                }
            }
        }

        return $this->nb_icontact_prospect;
    }
692607
public function init($force = false)
    {
        $flockFactory = new Factory(new FlockStore());

        $lock = $flockFactory->createLock('propel-cache-generation');

        // Acquire a blocking cache generation lock
        $lock->acquire(true);

        try {
            if ($force) {
                (new Filesystem())->remove($this->getPropelCacheDir());
            }

            if (!file_exists($this->getTheliaDatabaseConfigFile())) {
                return false;
            }

            $this->buildPropelConfig();

            $this->buildPropelInitFile();
            require $this->getPropelInitFile();

            $theliaDatabaseConnection = Propel::getConnection('thelia');
            $this->schemaLocator->setTheliaDatabaseConnection($theliaDatabaseConnection);

            $this->buildPropelGlobalSchema();

            $this->buildPropelModels();
            $this->registerPropelModelLoader();

            $theliaDatabaseConnection->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);

            if ($this->debug) {
                // In debug mode, we have to initialize Tlog at this point, as this class uses Propel
                Tlog::getInstance()->setLevel(Tlog::DEBUG);

                Propel::getServiceContainer()->setLogger('defaultLogger', Tlog::getInstance());
                $theliaDatabaseConnection->useDebug(true);
            }
        } catch (\Throwable $th) {
            $fs = new Filesystem();
            $fs->remove(THELIA_CACHE_DIR . $this->environment);
            $fs->remove($this->getPropelModelDir());
            throw $th;
        } finally {
            // Release cache generation lock
            $lock->release();
        }

        return true;
    }
15671
public function get($force = false)
    {
        // Check if current set
        if (is_null(self::$current) || $force) {
            // Get environment variable (if set and valid)
            $releaseStage = trim(getenv('RELEASE_STAGE'));
            $releaseStage = in_array($releaseStage, $this->getAll()) ? $releaseStage : null;

            // If environment variable not set/valid, try to detect environment by url or path
            $releaseStage = $releaseStage ?: $this->determineFromPath();

            $releaseStage = $releaseStage ?: $this->detectAppServer();

            // If environment variable still not set, assume we are in production!
            $releaseStage = $releaseStage ?: self::PRODUCTION;

            self::$current = $releaseStage;
        }

        return self::$current;
    }
715825
public function checkResources($force = false)
    {
        if (! ($resources = $this->getCachedResources($force))->isEmpty()) {
            return $resources;
        }

        if (! $this->allResourcesAreGood()) {
            return $this->resources = collect();
        }

        $resources = $this->sortResources(
            $this->getNonGlobalResources()
                ->each(function ($resource) {
                    $this->checkResource($resource);
                })
                ->merge(
                    $this->getGlobalResources()->each(function ($resource) {
                        return $resource->checkGlobal($this->getResources());
                    })
                )
        );

        $this->checked = true;

        return $this->resources = $this->cache->cacheResources($resources);
    }
1059633
public function getProfiles(bool $force = false) : CNabuSiteUserList
    {
        if ($this->nb_site_user_list->isEmpty() || $force) {
            $this->nb_site_user_list->clear();
            $this->nb_site_user_list->merge(CNabuSiteUser::getSitesForUser($this));
        }

        return $this->nb_site_user_list;
    }
1185779
public function getRoles(bool $force = false) : CNabuRoleList
    {
        if ($this->nb_role_list->isEmpty() || $force) {
            $this->nb_role_list->fillFromSite($this);
        }

        return $this->nb_role_list;
    }
1108671
public function drop($force = false)
    {
        $this->clearCache();
        
        $this->force = $force;

        return 'DROP TABLE ' . ($this->isForce() ? 'IF EXISTS ' : '') . '`' . $this->getCurrentTable()->getFullTableName() . '`;';
    }