Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
4535508d
Valider
4535508d
rédigé
11 years ago
par
diosmosis
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Refs #4200, documented Config.php.
parent
1f2975c3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
core/Common.php
+3
-10
3 ajouts, 10 suppressions
core/Common.php
core/Config.php
+31
-33
31 ajouts, 33 suppressions
core/Config.php
avec
34 ajouts
et
43 suppressions
core/Common.php
+
3
−
10
Voir le fichier @
4535508d
...
@@ -16,28 +16,21 @@ use Piwik\Tracker;
...
@@ -16,28 +16,21 @@ use Piwik\Tracker;
use
Piwik\Tracker\Cache
;
use
Piwik\Tracker\Cache
;
/**
/**
*
Static class providing function
s used by both
the CORE of
Piwik and the
visitor
Tracking engine.
*
Contains helper method
s used by both Piwik
Core
and the
Piwik
Tracking engine.
*
*
* This is the only external class loaded by the /piwik.php file.
* This is the only external class loaded by the /piwik.php file.
* This class should contain only the functions that are used in
* both the CORE and the piwik.php statistics logging engine.
*
*
* @package Piwik
* @package Piwik
*/
*/
class
Common
class
Common
{
{
/**
// constants used to map the referrer type to an integer in the log_visit table
* Const used to map the referrer type to an integer in the log_visit table
*/
const
REFERRER_TYPE_DIRECT_ENTRY
=
1
;
const
REFERRER_TYPE_DIRECT_ENTRY
=
1
;
const
REFERRER_TYPE_SEARCH_ENGINE
=
2
;
const
REFERRER_TYPE_SEARCH_ENGINE
=
2
;
const
REFERRER_TYPE_WEBSITE
=
3
;
const
REFERRER_TYPE_WEBSITE
=
3
;
const
REFERRER_TYPE_CAMPAIGN
=
6
;
const
REFERRER_TYPE_CAMPAIGN
=
6
;
/**
// Flag used with htmlspecialchar. See php.net/htmlspecialchars.
* Flag used with htmlspecialchar
* See php.net/htmlspecialchars
*/
const
HTML_ENCODING_QUOTE_STYLE
=
ENT_QUOTES
;
const
HTML_ENCODING_QUOTE_STYLE
=
ENT_QUOTES
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
core/Config.php
+
31
−
33
Voir le fichier @
4535508d
...
@@ -14,39 +14,36 @@ namespace Piwik;
...
@@ -14,39 +14,36 @@ namespace Piwik;
use
Exception
;
use
Exception
;
/**
/**
* For general performance (and specifically, the Tracker), we use deferred (lazy) initialization
* Singleton that provides read & write access to Piwik's INI configuration.
* and cache sections. We also avoid any dependency on Zend Framework's Zend_Config.
*
* This class reads and writes to the `config/config.ini.php` file. If config
* options are missing from that file, this class will look for their default
* values in `config/global.ini.php`.
*
* ### Examples
*
* **Getting a value:**
*
*
*
We use a parse_ini_file() wrapper to parse the configuration files, in case php's built-i
n
*
// read the minimum_memory_limit option under the [General] sectio
n
*
function is disabled.
*
$minValue = Config::getInstance()->General['minimum_memory_limit'];
*
*
* Example reading a value from the configuration:
* **Setting a value:**
*
* $minValue = Piwik_Config::getInstance()->General['minimum_memory_limit'];
*
* will read the value minimum_memory_limit under the [General] section of the config file.
*
* Example setting a section in the configuration:
*
* $brandingConfig = array(
* 'use_custom_logo' => 1,
* );
* Piwik_Config::getInstance()->branding = $brandingConfig;
*
* Example setting an option within a section in the configuration:
*
* $brandingConfig = Piwik_Config::getInstance()->branding;
* $brandingConfig['use_custom_logo'] = 1;
* Piwik_Config::getInstance()->branding = $brandingConfig;
*
*
* // set the minimum_memory_limit option
* Config::getInstance()->General['minimum_memory_limit'] = 256;
* Config::getInstance()->forceSave();
*
* **Setting an entire section:**
*
* Config::getInstance()->MySection = array('myoption' => 1);
* Config::getInstance()->forceSave();
*
* @package Piwik
* @package Piwik
* @subpackage Piwik_Config
* @subpackage Piwik_Config
* @static \Piwik\Config getInstance()
* @static \Piwik\Config getInstance()
*
*/
*/
class
Config
extends
Singleton
class
Config
extends
Singleton
{
{
/**
/**
* Contains configuration files values
* Contains configuration files values
*
*
...
@@ -270,12 +267,12 @@ class Config extends Singleton
...
@@ -270,12 +267,12 @@ class Config extends Singleton
}
}
/**
/**
* Magic get methods catching calls to $config->var_name
* Returns a configuration value or section by name.
* Returns the value if found in the configuration
*
*
* @param string $name
* @param string $name The value or section name.
* @return string|array The value requested, returned by reference
* @return string|array The requested value requested. Returned by reference.
* @throws Exception if the value requested not found in both files
* @throws Exception If the value requested not found in either `config.ini.php` or
* `global.ini.php`.
* @api
* @api
*/
*/
public
function
&
__get
(
$name
)
public
function
&
__get
(
$name
)
...
@@ -323,9 +320,9 @@ class Config extends Singleton
...
@@ -323,9 +320,9 @@ class Config extends Singleton
}
}
/**
/**
* Set
value
* Set
s a configuration value or section.
*
*
* @param string $name This
corresponds to the section name
* @param string $name This
section name or value name to set.
* @param mixed $value
* @param mixed $value
* @api
* @api
*/
*/
...
@@ -500,11 +497,12 @@ class Config extends Singleton
...
@@ -500,11 +497,12 @@ class Config extends Singleton
}
}
/**
/**
* Force save
* Writes the current configuration to `config.ini.php`.
*
* @api
* @api
*/
*/
public
function
forceSave
()
public
function
forceSave
()
{
{
$this
->
writeConfig
(
$this
->
configLocal
,
$this
->
configGlobal
,
$this
->
configCache
,
$this
->
pathLocal
);
$this
->
writeConfig
(
$this
->
configLocal
,
$this
->
configGlobal
,
$this
->
configCache
,
$this
->
pathLocal
);
}
}
}
}
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter