Changeset 24350


Ignore:
Timestamp:
Sep 5, 2013, 12:41:12 PM (11 years ago)
Author:
mistic100
Message:

add function conf_delete_param

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r24099 r24350  
    10871087}
    10881088
     1089/**
     1090 * Add or update a config parameter
     1091 * @param string $param
     1092 * @param string $value
     1093 */
    10891094function conf_update_param($param, $value)
    10901095{
     
    11161121;';
    11171122    pwg_query($query);
     1123  }
     1124}
     1125
     1126/**
     1127 * Delete on or more config parameters
     1128 * @since 2.6
     1129 * @param string|string[] $params
     1130 */
     1131function conf_delete_param($params)
     1132{
     1133  global $conf;
     1134 
     1135  if (!is_array($params))
     1136  {
     1137    $params = array($params);
     1138  }
     1139  if (empty($params))
     1140  {
     1141    return;
     1142  }
     1143 
     1144  $query = '
     1145DELETE FROM '.CONFIG_TABLE.'
     1146  WHERE param IN(\''. implode('\',\'', $params) .'\')
     1147;';
     1148  pwg_query($query);
     1149 
     1150  foreach ($params as $param)
     1151  {
     1152    unset($conf[$param]);
    11181153  }
    11191154}
Note: See TracChangeset for help on using the changeset viewer.