You are here

mylivechat.install in My Live Chat 7

Same filename and directory in other branches
  1. 6 mylivechat.install

Installation file for MyLiveChat module.

File

mylivechat.install
View source
<?php

/**
 * @file
 * Installation file for MyLiveChat module.
 */
define('MYLIVECHAT_PHP_VERSION', '5.0');

/**
 * Implements hook_requirements().
 */
function mylivechat_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();
  if ($phase == 'install') {

    // Test PHP version
    $requirements['php'] = array(
      'title' => $t('PHP'),
      'value' => $phase == 'runtime' ? l(phpversion(), 'admin/logs/status/php') : phpversion(),
    );
    if (version_compare(PHP_VERSION, MYLIVECHAT_PHP_VERSION) < 0) {
      $requirements['php']['description'] = $t('Your PHP installation is too old. LiveChat requires at least PHP %version.', array(
        '%version' => MYLIVECHAT_PHP_VERSION,
      ));
      $requirements['php']['severity'] = REQUIREMENT_ERROR;
    }
  }
  elseif ($phase == 'runtime') {

    // Raise warning if MyLiveChat user account has not been set yet.
    $mylivechat = mylivechat::get_instance();
    if ($mylivechat
      ->is_installed() == FALSE) {
      $requirements['mylivechat'] = array(
        'title' => t('MyLiveChat'),
        'description' => t('MyLiveChat is not properly configured. Please go to <a href="@url">MyLiveChat settings</a>.', array(
          '@url' => url('admin/settings/mylivechat'),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => t('Not configured'),
      );
    }
  }
  return $requirements;
}

/**
 * Implements hook_install().
 */
function mylivechat_install() {
}

/**
 * Implements hook_uninstall().
 */
function mylivechat_uninstall() {
  db_delete('variable')
    ->condition('name', 'mylivechat_%', 'LIKE')
    ->execute();
}

Functions

Constants

Namesort descending Description
MYLIVECHAT_PHP_VERSION @file Installation file for MyLiveChat module.