* @copyright CiviCRM LLC (c) 2004-2019
*/
+require_once 'Log.php';
require_once 'Mail.php';
require_once 'api/api.php';
*/
public static function &singleton($loadFromDB = TRUE, $force = FALSE) {
if (self::$_singleton === NULL || $force) {
- $GLOBALS['civicrm_default_error_scope'] = CRM_Core_TemporaryErrorScope::create(array('CRM_Core_Error', 'handle'));
- $errorScope = CRM_Core_TemporaryErrorScope::create(array('CRM_Core_Error', 'simpleHandler'));
+ $GLOBALS['civicrm_default_error_scope'] = CRM_Core_TemporaryErrorScope::create(['CRM_Core_Error', 'handle']);
+ $errorScope = CRM_Core_TemporaryErrorScope::create(['CRM_Core_Error', 'simpleHandler']);
if (defined('E_DEPRECATED')) {
error_reporting(error_reporting() & ~E_DEPRECATED);
* @return object
* @see Civi::log()
*/
- static public function &getLog() {
+ public static function &getLog() {
if (!isset(self::$_log)) {
self::$_log = Log::singleton('display');
}
// Whether we delete/create or simply preserve directories, we should
// certainly make sure the restrictions are enforced.
- foreach (array(
- $this->templateCompileDir,
- $this->uploadDir,
- $this->configAndLogDir,
- $this->customFileUploadDir,
- ) as $dir) {
+ foreach ([
+ $this->templateCompileDir,
+ $this->uploadDir,
+ $this->configAndLogDir,
+ $this->customFileUploadDir,
+ ] as $dir) {
if ($dir && is_dir($dir)) {
CRM_Utils_File::restrictAccess($dir);
}
$userID = $session->get('userID');
if ($userID) {
CRM_Core_DAO::executeQuery('SET @civicrm_user_id = %1',
- array(1 => array($userID, 'Integer'))
+ [1 => [$userID, 'Integer']]
);
}
}
else {
// Cannot store permissions -- warn if any modules require them
- $modules_with_perms = array();
+ $modules_with_perms = [];
foreach ($module_files as $module_file) {
$perms = $this->userPermissionClass->getModulePermissions($module_file['prefix']);
if (!empty($perms)) {
}
if (!empty($modules_with_perms)) {
CRM_Core_Session::setStatus(
- ts('Some modules define permissions, but the CMS cannot store them: %1', array(1 => implode(', ', $modules_with_perms))),
+ ts('Some modules define permissions, but the CMS cannot store them: %1', [1 => implode(', ', $modules_with_perms)]),
ts('Permission Error'),
'error'
);
* Clear db cache.
*/
public static function clearDBCache() {
- $queries = array(
+ $queries = [
'TRUNCATE TABLE civicrm_acl_cache',
'TRUNCATE TABLE civicrm_acl_contact_cache',
'TRUNCATE TABLE civicrm_cache',
'TRUNCATE TABLE civicrm_group_contact_cache',
'TRUNCATE TABLE civicrm_menu',
'UPDATE civicrm_setting SET value = NULL WHERE name="navigation" AND contact_id IS NOT NULL',
- );
+ ];
foreach ($queries as $query) {
CRM_Core_DAO::executeQuery($query);
$query .= " AND CREATE_TIME < DATE_SUB(NOW(), INTERVAL {$timeInterval})";
}
- $tableDAO = CRM_Core_DAO::executeQuery($query, array(1 => array($dao->database(), 'String')));
- $tables = array();
+ $tableDAO = CRM_Core_DAO::executeQuery($query, [1 => [$dao->database(), 'String']]);
+ $tables = [];
while ($tableDAO->fetch()) {
$tables[] = $tableDAO->tableName;
}
* @return bool
*/
public static function isEnabledBackOfficeCreditCardPayments() {
- return CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('BackOffice'));
+ return CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(['BackOffice']);
}
/**
/**
* Is the system permitted to flush caches at the moment.
*/
- static public function isPermitCacheFlushMode() {
+ public static function isPermitCacheFlushMode() {
return !CRM_Core_Config::singleton()->doNotResetCache;
}
* @param bool $enabled
* If true then caches can be cleared at this time.
*/
- static public function setPermitCacheFlushMode($enabled) {
+ public static function setPermitCacheFlushMode($enabled) {
CRM_Core_Config::singleton()->doNotResetCache = $enabled ? 0 : 1;
}