You are here

class ConfigHandler in DB Maintenance 2.0.x

Same name and namespace in other branches
  1. 8 src/Module/Config/ConfigHandler.php \Drupal\db_maintenance\Module\Config\ConfigHandler
  2. 7.2 src/Module/Config/ConfigHandler.php \Drupal\db_maintenance\Module\Config\ConfigHandler

ConfigHandler class.

Hierarchy

Expanded class hierarchy of ConfigHandler

4 files declare their use of ConfigHandler
CommonHookHandler.php in src/Module/Hook/CommonHookHandler.php
CommonHookHandler class.
DbHandler.php in src/Module/Db/DbHandler.php
DbHandler class.
DbMaintenanceAdminSettings.php in src/Form/DbMaintenanceAdminSettings.php
Contains \Drupal\db_maintenance\Form\DbMaintenanceAdminSettings.
IntervalHandler.php in src/Module/Interval/IntervalHandler.php
IntervalHandler class.

File

src/Module/Config/ConfigHandler.php, line 13
ConfigHandler class.

Namespace

Drupal\db_maintenance\Module\Config
View source
class ConfigHandler {

  /**
   * Returns last cron run.
   */
  public static function getCronLastRun() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('cron_last_run');
    return $val;
  }

  /**
   * Sets last cron run.
   */
  public static function setCronLastRun($value) {
    $config = \Drupal::configFactory()
      ->getEditable('db_maintenance.settings');
    $config
      ->set('cron_last_run', $value);
    $config
      ->save();
  }

  /**
   * Returns cron frequency.
   */
  public static function getCronFrequency() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('cron_frequency');
    return $val;
  }

  /**
   * Returns Log config value.
   */
  public static function getWriteLog() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('write_log');
    return $val;
  }

  /**
   * Returns UseTimeInterval variable.
   */
  public static function getUseTimeInterval() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('use_time_interval');
    return $val;
  }

  /**
   * Returns TimeIntervalStart variable.
   */
  public static function getTimeIntervalStart() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('time_interval_start');
    return $val;
  }

  /**
   * Returns TimeIntervalEnd variable.
   */
  public static function getTimeIntervalEnd() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('time_interval_end');
    return $val;
  }

  /**
   * Returns AllTables config value.
   */
  public static function getProcessAllTables() {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('all_tables');
    return $val;
  }

  /**
   * Returns TableList config value.
   */
  public static function getTableList($database, $default = NULL) {
    $val = \Drupal::config('db_maintenance.settings')
      ->get('table_list_' . $database);
    if (is_null($val)) {

      // This config key does not exist.
      return $default;
    }
    return $val;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigHandler::getCronFrequency public static function Returns cron frequency.
ConfigHandler::getCronLastRun public static function Returns last cron run.
ConfigHandler::getProcessAllTables public static function Returns AllTables config value.
ConfigHandler::getTableList public static function Returns TableList config value.
ConfigHandler::getTimeIntervalEnd public static function Returns TimeIntervalEnd variable.
ConfigHandler::getTimeIntervalStart public static function Returns TimeIntervalStart variable.
ConfigHandler::getUseTimeInterval public static function Returns UseTimeInterval variable.
ConfigHandler::getWriteLog public static function Returns Log config value.
ConfigHandler::setCronLastRun public static function Sets last cron run.